parcelRequire=function(e,r,n,t){function i(n,t){function o(e){return i(o.resolve(e))}function c(r){return e[n][1][r]||r}if(!r[n]){if(!e[n]){var l="function"==typeof parcelRequire&&parcelRequire;if(!t&&l)return l(n,!0);if(u)return u(n,!0);if(f&&"string"==typeof n)return f(n);var p=new Error("Cannot find module '"+n+"'");throw p.code="MODULE_NOT_FOUND",p}o.resolve=c;var a=r[n]=new i.Module(n);e[n][0].call(a.exports,o,a,a.exports,this)}return r[n].exports}function o(e){this.id=e,this.bundle=i,this.exports={}}var u="function"==typeof parcelRequire&&parcelRequire,f="function"==typeof require&&require;i.isParcelRequire=!0,i.Module=o,i.modules=e,i.cache=r,i.parent=u;for(var c=0;c<n.length;c++)i(n[c]);if(n.length){var l=i(n[n.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):t&&(this[t]=l)}return i}({72:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.unprefix=n,exports.toJSON=u;var e=require("./index"),r=t(e);function t(e){return e&&e.__esModule?e:{default:e}}function n(e,r,t,u=[]){if(Array.isArray(t))return t.map((t,o)=>{return n(e,r,t,u.concat(o))});if(r[u.join(".")]){let e=t;return new(r[u.join(".")])(e)}return null==t?null:"object"==typeof t?Object.keys(t).reduce((o,i)=>{let l=t[i];if(0===i.indexOf(`-${e}-`)&&void 0!==l){let t=i.slice(`-${e}-`.length);o[t]=n(e,r,l,u.concat(t))}return o},{}):t}function u(e,t){return Array.isArray(t)?t.map(r=>{return u(e,r)}):t instanceof r.default?t.toJSON():null==t?null:"object"==typeof t?Object.keys(t).reduce((r,n)=>{let o=t[n];return void 0!==o&&(r[`-${e}-${n}`]=u(e,o)),r},{}):t}
},{"./index":13}],54:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});class e{}exports.default=e;var t=exports.AdjacentBoundaryBehaviour=void 0;!function(e){e[e.preserve=0]="preserve",e[e.default=1]="default",e[e.modify=2]="modify"}(t||(exports.AdjacentBoundaryBehaviour=t={}));class s extends e{constructor(e,s,r=t.default){super(),this.start=e,this.end=s,this.behaviour=r,this.type="deletion"}}exports.Deletion=s;class r extends e{constructor(e,s,r=t.default){super(),this.start=e,this.text=s,this.behaviour=r,this.type="insertion"}}exports.Insertion=r;
},{}],53:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("./attributes"),s=require("./change");class e{constructor(t){let s=this.constructor;this.type=s.type,this.id=t.id,this.start=t.start,this.end=t.end,this.attributes=t.attributes}static hydrate(s){return new this({id:s.id,start:s.start,end:s.end,attributes:(0,t.unprefix)(this.vendorPrefix,this.subdocuments,s.attributes)})}handleChange(t){"insertion"===t.type?this.handleInsertion(t):this.handleDeletion(t)}handleDeletion(t){let s=t.end-t.start;this.end<t.start||(t.end<this.start?(this.start-=s,this.end-=s):t.end<this.end?t.start>this.start?this.end-=s:t.start<=this.start&&(this.start-=this.start-t.start,this.end-=s):t.end>=this.end&&(t.start<=this.start?(this.start=t.start,this.end=t.start):t.start>this.start&&(this.end=t.start)))}handleInsertion(t){let e=t.text.length;t.start<this.start?(this.start+=e,this.end+=e):t.start>this.start&&t.start<this.end?this.end+=e:t.behaviour===s.AdjacentBoundaryBehaviour.default?t.start===this.start?(this.start+=e,this.end+=e):t.start===this.end&&(this.end+=e):t.behaviour===s.AdjacentBoundaryBehaviour.preserve&&t.start===this.start?this.end+=e:t.start===this.end&&(this.end+=0)}clone(){return this.constructor.hydrate(this.toJSON())}toJSON(){let s=this.constructor.vendorPrefix;return{id:this.id,type:`-${s}-${this.type}`,start:this.start,end:this.end,attributes:(0,t.toJSON)(s,this.attributes)}}}exports.default=e,e.subdocuments={};
},{"./attributes":72,"./change":54}],79:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../annotation"),t=r(e);function r(e){return e&&e.__esModule?e:{default:e}}class u extends t.default{get rank(){return 10}}exports.default=u;
},{"../annotation":53}],80:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../annotation"),t=r(e);function r(e){return e&&e.__esModule?e:{default:e}}class u extends t.default{get rank(){return 100}}exports.default=u;
},{"../annotation":53}],81:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../annotation"),t=r(e);function r(e){return e&&e.__esModule?e:{default:e}}class u extends t.default{get rank(){return 1e3}}exports.default=u;
},{"../annotation":53}],82:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../annotation"),t=r(e);function r(e){return e&&e.__esModule?e:{default:e}}class n extends t.default{get rank(){return Number.MAX_SAFE_INTEGER}}exports.default=n,n.vendorPrefix="atjson",n.type="parse-token";
},{"../annotation":53}],83:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../annotation"),e=r(t);function r(t){return t&&t.__esModule?t:{default:t}}class s extends e.default{get rank(){return Number.MAX_SAFE_INTEGER}toJSON(){return{id:this.id,start:this.start,end:this.end,type:this.attributes.type,attributes:this.attributes.attributes}}}exports.default=s,s.vendorPrefix="atjson",s.type="unknown";
},{"../annotation":53}],69:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./block");Object.defineProperty(exports,"Block",{enumerable:!0,get:function(){return o(e).default}});var r=require("./inline");Object.defineProperty(exports,"Inline",{enumerable:!0,get:function(){return o(r).default}});var t=require("./object");Object.defineProperty(exports,"Object",{enumerable:!0,get:function(){return o(t).default}});var n=require("./parse");Object.defineProperty(exports,"Parse",{enumerable:!0,get:function(){return o(n).default}});var u=require("./unknown");function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(exports,"Unknown",{enumerable:!0,get:function(){return o(u).default}});
},{"./block":79,"./inline":80,"./object":81,"./parse":82,"./unknown":83}],56:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});class t{constructor(t,e){this.leftJoin=t,this._joins=e}*[Symbol.iterator](){for(let t of this._joins)yield t}get length(){return this._joins.length}toJSON(){return[...this].map(t=>{let e={};return Object.keys(t).forEach(n=>{let o=t[n];return Array.isArray(o)?e[n]=o.map(t=>t.toJSON()):e[n]=o.toJSON(),e}),e})}join(e,n){if(e.document!==this.leftJoin.document)throw new Error("Joining annotations from two different documents is non-sensical. Refusing to continue.");let o=new t(this.leftJoin,[]);return this._joins.forEach(t=>{let i=e.annotations.filter(e=>n(t,e));i.length>0&&(t[e.name]=i,o.push(t))}),o}push(t){this._joins.push(t)}update(t){this._joins.forEach(t)}}exports.default=t;
},{}],55:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.NamedCollection=exports.Collection=void 0;var t=require("./join"),e=n(t);function n(t){return t&&t.__esModule?t:{default:t}}function o(t,e){return Object.keys(e).every(n=>{let r=e[n];return"object"==typeof r?o(t[n],r):t[n]===r})}class r{constructor(t,e){this.document=t,this.annotations=e}*[Symbol.iterator](){for(let t of this.annotations)yield t}get length(){return this.annotations.length}map(t){return this.annotations.map(t)}where(t){if(t instanceof Function)return new l(this.document,this.annotations.filter(t));let e=this.annotations.filter(e=>o(e.toJSON(),t));return new l(this.document,e)}as(t){return new c(this.document,this.annotations,t)}update(t){let e=[];return this.annotations.map(t).map(t=>{let e=[];return t&&(t.add&&e.push(...t.add),t.update&&e.push(...t.update.map(t=>t[1])),t.retain&&e.push(...t.retain)),e}).reduce((t,e)=>(t.push(...e),t),e),this.annotations=e,this}}function i(t,e,n){return Object.keys(t).reduce((o,r)=>{let s=t[r],u=r;return n&&(u=`${n}.${r}`,e.values&&(s=`${n}.${s}`)),"object"!=typeof s?o[u]=s:Object.assign(o,i(s,e,u)),o},{})}function s(t,e){let n={};return Object.keys(t).forEach(o=>{let r=e.filter(t=>t.split(".")[0]===o);0===r.length?n[o]=t[o]:-1===r.indexOf(o)&&(n[o]=s(t[o],r.map(t=>t.split(".").slice(1).join("."))))}),n}function u(t,e){if(""===e)return t;let[n,...o]=e.split(".");return t?u(t[n],o.join(".")):null}function a(t,e,n){if(null==n)return;let[o,...r]=e.split(".");0===r.length?t[o]=n:(null==t[o]&&(t[o]={}),a(t[o],r.join("."),n))}exports.Collection=r;class l extends r{set(t){let e=i(t,{keys:!0});return this.update(t=>{let n=t.toJSON();return Object.keys(e).forEach(t=>{a(n,t,e[t])}),{update:[[t,this.document.replaceAnnotation(t,n)[0]]]}})}unset(...t){return this.update(e=>{let n=s(e.toJSON(),t);return{update:[[e,this.document.replaceAnnotation(e,n)[0]]]}})}rename(t){let e=i(t,{keys:!0,values:!0});return this.update(t=>{let n=t.toJSON(),o=s(t.toJSON(),Object.keys(e));return Object.keys(e).forEach(t=>{let r=u(n,t);a(o,e[t],r)}),{update:[[t,this.document.replaceAnnotation(t,o)[0]]]}})}remove(){return this.update(t=>(this.document.removeAnnotation(t),{remove:[t]}))}}exports.default=l;class c extends r{constructor(t,e,n){super(t,e),this.name=n}join(t,n){if(t.document!==this.document)throw new Error("Joining annotations from two different documents is non-sensical. Refusing to continue.");let o=new e.default(this,[]);return this.annotations.forEach(e=>{let r=t.annotations.filter(t=>n(e,t));if(r.length>0){let n={[this.name]:e,[t.name]:r};o.push(n)}}),o}}exports.NamedCollection=c;
},{"./join":56}],13:[function(require,module,exports) {
"use strict";e.Object.defineProperty(exports,"__esModule",{value:!0}),exports.UnknownAnnotation=exports.ParseAnnotation=exports.Join=exports.ObjectAnnotation=exports.Insertion=exports.InlineAnnotation=exports.Deletion=exports.Change=exports.BlockAnnotation=exports.AnnotationCollection=exports.Annotation=exports.AdjacentBoundaryBehaviour=void 0;var t=require("./annotation"),n=c(t),e=require("./annotations"),o=require("./change"),i=c(o),r=require("./collection"),s=c(r),a=require("./join"),h=c(a);function c(t){return t&&t.__esModule?t:{default:t}}exports.AdjacentBoundaryBehaviour=o.AdjacentBoundaryBehaviour,exports.Annotation=n.default,exports.AnnotationCollection=s.default,exports.BlockAnnotation=e.Block,exports.Change=i.default,exports.Deletion=o.Deletion,exports.InlineAnnotation=e.Inline,exports.Insertion=o.Insertion,exports.ObjectAnnotation=e.Object,exports.Join=h.default,exports.ParseAnnotation=e.Parse,exports.UnknownAnnotation=e.Unknown;class l{constructor(t){let n=this.constructor;this.content=t.content,this.contentType=n.contentType,this.annotations=t.annotations.map(t=>this.createAnnotation(t)),this.changeListeners=[]}addEventListener(t,n){if("change"!==t)throw new Error("Unsupported event. `change` is the only constant.");this.changeListeners.push(n)}addAnnotations(...t){this.annotations.push(...t.map(t=>this.createAnnotation(t))),this.triggerChange()}where(t){return new s.default(this,this.annotations).where(t)}removeAnnotation(t){let n=this.annotations.indexOf(t);if(n>-1)return this.triggerChange(),this.annotations.splice(n,1)[0]}replaceAnnotation(t,...e){let o=this.annotations.indexOf(t);if(o>-1){let t=e.map(t=>t instanceof n.default?t:this.createAnnotation(t));return this.annotations.splice(o,1,...t),t}return this.triggerChange(),[]}insertText(t,n,e=o.AdjacentBoundaryBehaviour.default){if(t<0||t>this.content.length)throw new Error("Invalid position.");let i=new o.Insertion(t,n,e);try{for(let t=this.annotations.length-1;t>=0;t--){this.annotations[t].handleChange(i)}this.content=this.content.slice(0,t)+n+this.content.slice(t)}catch(t){console.error("Failed to insert text",t)}this.triggerChange()}deleteText(t,n,e=o.AdjacentBoundaryBehaviour.default){let i=new o.Deletion(t,n,e);try{for(let t=this.annotations.length-1;t>=0;t--){this.annotations[t].handleChange(i)}this.content=this.content.slice(0,t)+this.content.slice(n)}catch(t){console.error("Failed to delete text",t)}this.triggerChange()}slice(t,n){let e=this.clone();return e.deleteText(0,t),e.deleteText(n,e.content.length),e}toJSON(){let t=this.constructor.schema;return{content:this.content,contentType:this.contentType,annotations:this.annotations.map(t=>t.toJSON()),schema:t.map(t=>`-${t.vendorPrefix}-${t.type}`)}}clone(){return new(0,this.constructor)(this.toJSON())}createAnnotation(t){let n=[...this.constructor.schema,e.Parse].find(n=>{let e=`-${n.vendorPrefix}-${n.type}`;return t.type===e});return n?n.hydrate(t):new e.Unknown({id:t.id,start:t.start,end:t.end,attributes:{type:t.type,attributes:t.attributes}})}triggerChange(){this.pendingChangeEvent||(this.pendingChangeEvent=setTimeout(t=>{this.changeListeners.forEach(t=>t()),delete this.pendingChangeEvent},0))}}exports.default=l,l.schema=[];
},{"./annotation":53,"./annotations":69,"./change":54,"./collection":55,"./join":56}],85:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@atjson/document");class t extends e.Annotation{get rank(){return 0}}exports.default=t,t.vendorPrefix="atjson",t.type="root";
},{"@atjson/document":13}],86:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@atjson/document");class t extends e.Annotation{get rank(){return 1/0}}exports.default=t,t.vendorPrefix="atjson",t.type="text";
},{"@atjson/document":13}],84:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./root");Object.defineProperty(exports,"Root",{enumerable:!0,get:function(){return r(e).default}});var t=require("./text");function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(exports,"Text",{enumerable:!0,get:function(){return r(t).default}});
},{"./root":85,"./text":86}],93:[function(require,module,exports) {
var e="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(e){var o=new Uint8Array(16);module.exports=function(){return e(o),o}}else{var r=new Array(16);module.exports=function(){for(var e,o=0;o<16;o++)0==(3&o)&&(e=4294967296*Math.random()),r[o]=e>>>((3&o)<<3)&255;return r}}
},{}],94:[function(require,module,exports) {
for(var r=[],o=0;o<256;++o)r[o]=(o+256).toString(16).substr(1);function t(o,t){var n=t||0,u=r;return[u[o[n++]],u[o[n++]],u[o[n++]],u[o[n++]],"-",u[o[n++]],u[o[n++]],"-",u[o[n++]],u[o[n++]],"-",u[o[n++]],u[o[n++]],"-",u[o[n++]],u[o[n++]],u[o[n++]],u[o[n++]],u[o[n++]],u[o[n++]]].join("")}module.exports=t;
},{}],90:[function(require,module,exports) {
var e,r,o=require("./lib/rng"),s=require("./lib/bytesToUuid"),i=0,n=0;function c(c,l,u){var v=l&&u||0,a=l||[],d=(c=c||{}).node||e,t=void 0!==c.clockseq?c.clockseq:r;if(null==d||null==t){var m=o();null==d&&(d=e=[1|m[0],m[1],m[2],m[3],m[4],m[5]]),null==t&&(t=r=16383&(m[6]<<8|m[7]))}var q=void 0!==c.msecs?c.msecs:(new Date).getTime(),f=void 0!==c.nsecs?c.nsecs:n+1,b=q-i+(f-n)/1e4;if(b<0&&void 0===c.clockseq&&(t=t+1&16383),(b<0||q>i)&&void 0===c.nsecs&&(f=0),f>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");i=q,n=f,r=t;var k=(1e4*(268435455&(q+=122192928e5))+f)%4294967296;a[v++]=k>>>24&255,a[v++]=k>>>16&255,a[v++]=k>>>8&255,a[v++]=255&k;var w=q/4294967296*1e4&268435455;a[v++]=w>>>8&255,a[v++]=255&w,a[v++]=w>>>24&15|16,a[v++]=w>>>16&255,a[v++]=t>>>8|128,a[v++]=255&t;for(var g=0;g<6;++g)a[v+g]=d[g];return l||s(a)}module.exports=c;
},{"./lib/rng":93,"./lib/bytesToUuid":94}],91:[function(require,module,exports) {
var r=require("./lib/rng"),n=require("./lib/bytesToUuid");function e(e,i,u){var a=i&&u||0;"string"==typeof e&&(i="binary"===e?new Array(16):null,e=null);var l=(e=e||{}).random||(e.rng||r)();if(l[6]=15&l[6]|64,l[8]=63&l[8]|128,i)for(var o=0;o<16;++o)i[a+o]=l[o];return i||n(l)}module.exports=e;
},{"./lib/rng":93,"./lib/bytesToUuid":94}],89:[function(require,module,exports) {
var e=require("./v1"),r=require("./v4"),v=r;v.v1=e,v.v4=r,module.exports=v;
},{"./v1":90,"./v4":91}],76:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@atjson/document"),i=h(t),s=require("uuid"),e=require("./annotations"),n=require("./hir"),r=h(n);function h(t){return t&&t.__esModule?t:{default:t}}function a(t){return Array.isArray(t)?t.map(t=>{return a(t)}):t instanceof i.default?new r.default(t):null==t?null:"object"==typeof t?Object.keys(t).reduce((i,s)=>{let e=t[s];return i[s]=null==e?e:a(e),i},{}):t}function l(t){return Array.isArray(t)?t.map(t=>{return l(t)}):t instanceof r.default?t.toJSON():null==t?null:"object"==typeof t?Object.keys(t).reduce((i,s)=>{let e=t[s];return i[s]=null==e?e:l(e),i},{}):t}class d{get type(){return this.annotation.type}get rank(){return this.annotation.rank}constructor(t){this.annotation=t,this.id=t.id,this.start=t.start,this.end=t.end,this.attributes=a(t.attributes)}toJSON(){return this.annotation instanceof e.Text?this.annotation.attributes.text:{id:this.id,type:this.type,attributes:l(this.attributes),children:this.children().map(t=>t.toJSON())}}children(i){if(this.child){let s=[this.child].concat(this.child.siblings());return i&&i.includeParseTokens||(s=s.filter(i=>!(i.annotation instanceof t.ParseAnnotation))),s}return[]}siblings(){return this.sibling?[this.sibling].concat(this.sibling.siblings()):[]}insertAnnotation(t){this.insertNode(new d(t))}insertText(t){if(!(this.annotation instanceof e.Root))throw new Error("temporary exception; this should only exist in the root node subclass");if(0===t.length)return;if(1===t.length&&this.end-this.start==1&&"￼"===t)return;let i=new d(new e.Text({id:(0,s.v4)(),start:this.start,end:this.end,attributes:{text:t}}));this.insertNode(i)}insertNode(t){let i=!1;if("text"!==this.type){if(this.start===t.start&&this.end===t.end)return void this.insertChild(t);if(this.start<=t.start){if(t.start===t.end&&this.end===t.end&&this.rank===t.rank)return void this.insertSibling(t);let s=t.trim(this.start,this.end);s&&(this.insertChild(s),s.end===t.end&&(i=!0))}}if(this.end<=t.end&&!i){let i=t.trim(this.end,t.end);i&&this.insertSibling(i)}}insertSibling(t){if(this.sibling)if(t.rank<this.sibling.rank)if(this.sibling.start<t.start){let i=this.sibling.trim(this.end,t.start),s=this.sibling.trim(t.start,this.sibling.end);s&&t.insertNode(s),i?(i.insertNode(t),this.sibling=i):this.sibling=t}else t.insertNode(this.sibling),this.sibling=t;else if(t.start<this.sibling.start){let i=t.trim(this.end,this.sibling.start),s=t.trim(this.sibling.start,t.end);s&&this.sibling.insertNode(s),i&&(i.insertNode(this.sibling),this.sibling=i)}else this.sibling.insertNode(t);else this.sibling=t}insertChild(t){if(this.child)if(t.rank<this.child.rank)if(this.child.start<t.start){let i=this.child.trim(this.child.start,t.start),s=this.child.trim(this.start,this.child.end);s&&t.insertNode(s),i&&(i.insertNode(t),this.child=i)}else t.insertNode(this.child),this.child=t;else if(t.start<this.child.start){let i=t.trim(this.start,this.child.start),s=t.trim(this.child.start,t.end);s&&this.child.insertNode(s),i&&(i.insertNode(this.child),this.child=i)}else this.child.insertNode(t);else this.child=t}trim(t,i){let n=Math.max(this.start,t),r=Math.min(this.end,i);if(n===this.start&&r===this.end)return this;let h=this.annotation.clone();if(h.start=Math.min(Math.max(h.start,t),h.end),h.end=Math.max(h.start,Math.min(h.end,i)),this.annotation instanceof e.Text){let t=h.attributes.text;h.id=(0,s.v4)(),h.attributes.text=t.slice(h.start-this.start,h.end-this.start)}let a=new d(h);if(a.start!==a.end){if(a.start>a.end)throw new Error("something has gone catastrophically wrong");if(!(this.annotation instanceof e.Text&&"￼"===a.annotation.attributes.text))return a}}}exports.default=d;
},{"@atjson/document":13,"uuid":89,"./annotations":84,"./hir":75}],75:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("uuid"),e=require("./annotations"),r=require("./hir-node"),o=n(r);function n(t){return t&&t.__esModule?t:{default:t}}class s{constructor(r){let n=r.clone();n.annotations.filter(t=>t.start===t.end).forEach(t=>{n.insertText(t.start,"￼"),t.start=Math.max(0,t.start-1)}),this.rootNode=new o.default(new e.Root({id:(0,t.v4)(),start:0,end:n.content.length,attributes:{}})),n.annotations.sort((t,e)=>t.start===e.start?t.type===e.type?t.end-e.end:e.end-e.start-(t.end-t.start):t.start-e.start).forEach(t=>this.rootNode.insertAnnotation(t)),this.rootNode.insertText(n.content)}toJSON(){return this.rootNode.toJSON()}}exports.default=s;
},{"uuid":89,"./annotations":84,"./hir-node":76}],71:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TextAnnotation=exports.RootAnnotation=exports.HIR=exports.HIRNode=void 0;var e=require("./annotations"),t=require("./hir"),o=i(t),r=require("./hir-node"),n=i(r);function i(e){return e&&e.__esModule?e:{default:e}}exports.HIRNode=n.default,exports.HIR=o.default,exports.RootAnnotation=e.Root,exports.TextAnnotation=e.Text;
},{"./annotations":84,"./hir":75,"./hir-node":76}],51:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@atjson/hir");class t{constructor(e){this.document=e}text({text:e}){if("\n"===e[e.length-1]){let t=e.split("\n");""===t[t.length-1]&&t.pop();let n=t.map(e=>{let t=document.createElement("span");return t.style.whiteSpace="normal",t.style.display="none",t.contentEditable="false",t.appendChild(document.createTextNode("\n")),[document.createTextNode(e),t]}).reduce((e,t)=>e.concat(t)),r=document.createElement("span");return n.forEach(e=>{r.appendChild(e)}),r}return document.createTextNode(e)}render(){let t=new Map,n=new e.HIR(this.document),r=document.createElement("div");return this.compile(t,n.rootNode.children()).forEach(e=>{r.appendChild(e)}),r}compile(e,t){return t.map(t=>{let n=t.children();if(n.length>0){let r;return"function"==typeof this[t.type]?r=this[t.type](t):(r=document.createElement("span")).classList.add("unknown-annotation"),t.id&&r.setAttribute("data-annotation-id",t.id.toString()),e.set(r,t),this.compile(e,n).forEach(e=>{r.appendChild(e)}),r}{let n;return n="function"==typeof this[t.type]?this[t.type](t):"",e.set(n,t),n}})}}exports.default=t;
},{"@atjson/hir":71}],26:[function(require,module,exports) {
"use strict";function e(e,t){let[n,...s]=t.split(" "),r=s.join(" ");if("document"===r)return{eventName:n,element:document};if("window"===r)return{eventName:n,element:window};if(""===r)return{eventName:n,element:e};{let t;return{eventName:n,element:t=e.shadowRoot&&e.shadowRoot.querySelector(r)||e.querySelector(r)}}}Object.defineProperty(exports,"__esModule",{value:!0});class t extends HTMLElement{constructor(){super(),this.eventHandlers={}}connectedCallback(){let t=this.constructor.events||{};Object.keys(t).forEach(n=>{let{eventName:s,element:r}=e(this,n),o=t[n];this.eventHandlers[n]=(e=>{if("string"==typeof o){const t=this[o];if(t instanceof Function)return t.call(this,e);throw new Error(`😭 \`${o}\` was not defined on ${this.tagName}- did you misspell  or forget to add it?`)}return o.call(this,e)}),r.addEventListener(s,this.eventHandlers[n])})}disconnectedCallback(){Object.keys(this.eventHandlers).forEach(t=>{let{eventName:n,element:s}=e(this,t);s.removeEventListener(n,this.eventHandlers[t])}),this.eventHandlers={}}}exports.default=t;
},{}],61:[function(require,module,exports) {

"use strict";function e(e,t){let[n,...s]=t.split(" "),o=s.join(" ");if("document"===o)return{eventName:n,element:document};if("window"===o)return{eventName:n,element:window};if(""===o)return{eventName:n,element:e};{let t;return{eventName:n,element:t=e.shadowRoot&&e.shadowRoot.querySelector(o)||e.querySelector(o)}}}function t(e,t){return window.customElements.get(e)||window.customElements.define(e,t),t}Object.defineProperty(exports,"__esModule",{value:!0}),exports.define=t;class n extends HTMLElement{static get compiledTemplate(){if(!this.compiledElement){this.compiledElement=document.createElement("template");let e=this.style,t=this.template;e&&(t=`<style>${e}</style>${t}`),this.compiledElement.innerHTML=t}return this.compiledElement}constructor(){super(),this.eventHandlers={};let e=this.constructor;this.attachShadow({mode:"open"}).appendChild(e.compiledTemplate.content.cloneNode(!0))}connectedCallback(){let t=this.constructor.events||{};Object.keys(t).forEach(n=>{let{eventName:s,element:o}=e(this,n),l=t[n];this.eventHandlers[n]=(e=>{if("string"==typeof l){const t=this[l];if(t instanceof Function)return t.call(this,e);throw new Error(`😭 \`${l}\` was not defined on ${this.tagName}- did you misspell  or forget to add it?`)}return l.call(this,e)}),o.addEventListener(s,this.eventHandlers[n])})}disconnectedCallback(){Object.keys(this.eventHandlers).forEach(t=>{let{eventName:n,element:s}=e(this,t);s.removeEventListener(n,this.eventHandlers[t])}),this.eventHandlers={}}}exports.default=n;
},{}],23:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./mixins/component"),t=o(e);function o(e){return e&&e.__esModule?e:{default:e}}class n extends t.default{onSelectionChange(e){this.shadowRoot&&this.shadowRoot.childNodes.forEach(t=>{let o=new CustomEvent(e.type,{bubbles:!1,cancelable:!0,detail:e.detail});t.dispatchEvent(o)})}}exports.default=n,n.template="",n.style="\n    :host {\n      border-radius: 4px;\n    }\n  ",n.events={selectionchange:"onSelectionChange"},window.customElements.get("selection-toolbar")||window.customElements.define("selection-toolbar",n);
},{"./mixins/component":61}],24:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./mixins/events"),t=n(e);function n(e){return e&&e.__esModule?e:{default:e}}const s=3;function a(e){let t=[];return e.hasChildNodes()?e.childNodes.forEach(e=>{t=t.concat(a(e))}):e.nodeType===s&&t.push(e),t}class i extends t.default{clearSelection(){this.selection=null}setSelection(e){this.selection=e.detail}compositionend(e){if(!this.selection)return;let{start:t,end:n}=this.selection;t===n?this.dispatchEvent(new CustomEvent("insertText",{bubbles:!0,detail:{position:t,text:e.data}})):this.dispatchEvent(new CustomEvent("replaceText",{bubbles:!0,detail:{start:t,end:n,text:e.data}}))}beforeinput(e){if(e.isComposing)return;let t,n,s,a;if(this.selection)switch(t=this.selection.start,n=this.selection.end,e.inputType){case"insertText":t===n?this.dispatchEvent(new CustomEvent("insertText",{bubbles:!0,detail:{position:t,text:e.data}})):this.dispatchEvent(new CustomEvent("replaceText",{bubbles:!0,detail:{start:t,end:n,text:e.data}}));break;case"insertLineBreak":this.dispatchEvent(new CustomEvent("insertText",{bubbles:!0,detail:{position:t,text:"\u2028"}})),this.dispatchEvent(new CustomEvent("addAnnotation",{bubbles:!0,detail:{type:"line-break",start:t,end:n+1}}));break;case"insertFromPaste":s=e.dataTransfer.getData("text/plain"),t===n?this.dispatchEvent(new CustomEvent("insertText",{bubbles:!0,detail:{position:t,text:s}})):this.dispatchEvent(new CustomEvent("replaceText",{bubbles:!0,detail:{start:t,end:n,text:s}}));break;case"insertFromDrop":s=e.dataTransfer.getData("text/plain"),a=e.getTargetRanges()[0],t=this.nodeAndOffsetToDocumentOffset(a.startContainer,a.startOffset),this.dispatchEvent(new CustomEvent("insertText",{bubbles:!0,detail:{position:t,text:s}}));break;case"deleteContentBackward":this.selection.collapsed&&t--,this.dispatchEvent(new CustomEvent("deleteText",{bubbles:!0,detail:{start:t,end:n}}));break;case"deleteWordBackward":case"deleteWordForward":"deleteWordBackward"===e.inputType&&this.selection.collapsed&&n++,a=e.getTargetRanges()[0];let i=this.nodeAndOffsetToDocumentOffset(a.startContainer,a.startOffset),o=this.nodeAndOffsetToDocumentOffset(a.endContainer,a.endOffset);this.dispatchEvent(new CustomEvent("deleteText",{bubbles:!0,detail:{start:i,end:o}}));break;case"deleteContentForward":this.selection.collapsed&&n++,this.dispatchEvent(new CustomEvent("deleteText",{bubbles:!0,detail:{start:t,end:n}}));break;case"deleteByCut":case"deleteContent":case"deleteByDrag":this.dispatchEvent(new CustomEvent("deleteText",{bubbles:!0,detail:{start:t,end:n}}));break;case"insertReplacementText":if(1!==e.getTargetRanges().length)throw new Error("Unhandled scenario. Breaking in an unelegant way. Expected exactly one target range in insertReplacementText handler, got "+e.getTargetRanges().length);a=e.getTargetRanges()[0];let r=this.nodeAndOffsetToDocumentOffset(a.startContainer,a.startOffset),d=this.nodeAndOffsetToDocumentOffset(a.endContainer,a.endOffset);e.dataTransfer.items[0].getAsString(e=>{this.dispatchEvent(new CustomEvent("replaceText",{bubbles:!0,detail:{start:r,end:d,text:e}}))});break;case"formatBold":this.dispatchEvent(new CustomEvent("addAnnotation",{bubbles:!0,detail:{start:t,end:n,type:"bold"}}));break;case"formatItalic":this.dispatchEvent(new CustomEvent("addAnnotation",{bubbles:!0,detail:{start:t,end:n,type:"italic"}}));break;case"formatUnderline":e.preventDefault();break;case"insertParagraph":e.preventDefault(),this.dispatchEvent(new CustomEvent("insertText",{bubbles:!0,detail:{position:t,text:"\n"}}))}}nodeAndOffsetToDocumentOffset(e,t){let n=a(this),s=n.length,i=0;for(let a=0;a<s;a++){let s=n[a];if(s===e)return i+t;i+=(s.nodeValue||"").length}throw new Error("Did not find a matching node. Was matching against")}}i.events={beforeinput:"beforeinput",compositionend:"compositionend","change text-selection":"setSelection","clear text-selection":"clearSelection"},customElements.define("text-input",i),exports.default=i;
},{"./mixins/events":26}],25:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./mixins/events"),t=s(e);function s(e){return e&&e.__esModule?e:{default:e}}const o=3,n=2,i=4;function r(e,t){return e+t}function l(e){let t=[];return e.hasChildNodes()?e.childNodes.forEach(e=>{t=t.concat(l(e))}):e.nodeType===o&&t.push(e),t}function u(e){let t=e;for(;t;){let e=l(t);if(e.length)return[e[0],0];t=t.nextSibling}return e.parentNode?u(e.parentNode):[null,0]}function c(e){let t=e;for(;t;){let e=l(t);if(e.length){let t=e[e.length-1];return[t,t.length]}t=t.previousSibling}return e.parentNode?c(e.parentNode):[null,0]}class a extends t.default{constructor(){super(),this.textNodes=[],this.composing=!1}startComposition(){this.composing=!0}endComposition(){this.composing=!1}setSelection(e){this.reset();let t=this.textNodes.length,s=0;for(let o=0;o<t;o++){let t=this.textNodes[o];if(s+(t.nodeValue||"").length>=e.start){let o=document.getSelection(),n=document.createRange();n.setStart(t,e.start-s),t.parentNode instanceof HTMLElement&&t.parentNode.focus(),o&&(o.removeAllRanges(),o.addRange(n));break}s+=(t.nodeValue||"").length}}connectedCallback(){super.connectedCallback();let e=this.attachShadow({mode:"open"}),t=document.createElement("template");t.innerHTML='<style>.toolbar { position: absolute; display: none; }</style><div class="toolbar"><slot name="toolbar"></slot></div><slot></slot>',e.appendChild(t.content.cloneNode(!0)),this.observer=new MutationObserver(()=>this.reset()),this.observer.observe(this,{childList:!0,characterData:!0,subtree:!0}),this.reset()}reset(){this.textNodes=l(this)}disconnectedCallback(){super.disconnectedCallback(),this.observer&&(this.observer.disconnect(),this.observer=null),this.textNodes=[]}handleCursorFocus(e,t){3===t.focusNode.nodeType&&(!this._focusNode||this._focusNode===t.focusNode&&e.start===e.end||(this._focusNode.dispatchEvent(new CustomEvent("cursorblur",{bubbles:!0})),delete this._focusNode),e.start===e.end&&(this._previousRange&&e.start===this._previousRange.start?this._focusNode||(this._focusNode=t.focusNode):this._focusNode!==t.focusNode&&(this._focusNode=t.focusNode,this._previousRange=e,this._focusNode.dispatchEvent(new CustomEvent("cursorfocus",{bubbles:!0})))))}updateToolbar(e,t){if(!this.shadowRoot)return;let s=this.shadowRoot.querySelector(".toolbar");if(!s)return;let o=s.style;e.start===e.end?o.display="none":window.requestAnimationFrame(e=>{if(!s)return;let n=t.getRangeAt(0).getBoundingClientRect();o.display="block",o.top=(n.top-s.offsetHeight-3).toString(),o.left=n.left.toString()})}resumeInput(){this._previousRange&&(this.setSelection(this._previousRange),this._focusNode&&this._focusNode.dispatchEvent(new CustomEvent("cursorblur",{bubbles:!0})))}getNodeAndOffset([e,t],s){if(null==e)return[null,t];if(e.nodeType===o)return[e,t];if(this.contains(e)||this===e){if(e.childNodes.length>t){let o=l(e.childNodes[t]);return 1===o.length?[o[0],0]:0===o.length?s?c(e):u(e):null}if(e.childNodes.length===t){let t=l(e),s=t[t.length-1];return[s,s?s.length:0]}return[null,t]}switch(this.compareDocumentPosition(e)){case n:return c(e);case i:return u(e);default:return[null,0]}}clampRangePoint([e,t]){if(null==e)return[e,t];let s=this.textNodes[0],o=this.textNodes[this.textNodes.length-1];return s.compareDocumentPosition(e)===n?[s,0]:o.compareDocumentPosition(e)===i?[o,o.length]:[e,t]}clearSelection(){this.removeAttribute("start"),this.removeAttribute("end"),this.dispatchEvent(new CustomEvent("clear"))}selectedTextDidChange(){if(this.composing)return;let e=document.getSelection(),t=this.textNodes,s=[[e.baseNode,e.baseOffset],[e.extentNode,e.extentOffset]];e.anchorNode&&(s=[[e.anchorNode,e.anchorOffset],[e.focusNode,e.focusOffset]]),s=s.sort(([e,t],[s,o])=>{if(!e||!s)return 0;switch(e.compareDocumentPosition(s)){case n:return 1;case i:return-1;default:return t-o}});let[o,l]=[this.getNodeAndOffset(s[0],!0),this.getNodeAndOffset(s[1],!1)];if(null===o||null===l)return;let u=o[0],c=l[0];if(null===u||null===c)return this.clearSelection(),!0;let a=u!==c||o[1]!==l[1],d=document.createRange();if(u.parentNode instanceof Node&&c.parentNode instanceof Node){d.setStart(u,o[1]),d.setEnd(c,l[1]);let s=d.commonAncestorContainer;if(!this.contains(s)&&!s.contains(this))return this.clearSelection(),!0;this.contains(s)||this===s||(o=this.clampRangePoint(o),l=this.clampRangePoint(l));let n=t.map(e=>(e.nodeValue||"").length),i={start:n.slice(0,t.indexOf(u)).reduce(r,o[1]),end:n.slice(0,t.indexOf(c)).reduce(r,l[1])};return!(i.start!==i.end||!a)||(clearTimeout(this._cursorToolbarResetTimeout),this._cursorToolbarResetTimeout=setTimeout(t=>{delete this._cursorToolbarResetTimeout,this.handleCursorFocus(i,e),this.updateToolbar(i,e)},500),this.setAttribute("start",i.start.toString()),this.setAttribute("end",i.end.toString()),this.dispatchEvent(new CustomEvent("change",{detail:{start:i.start,end:i.end,collapsed:i.start===i.end}})),!0)}throw new Error("This should not happen. This check is for typescript, but should never be triggered.")}}a.observedAttributes=["start","end"],a.events={"selectionchange document":"selectedTextDidChange",compositionstart:"startComposition",compositionend:"endComposition",resumeinput:"resumeInput"},customElements.define("text-selection",a),exports.default=a;
},{"./mixins/events":26}],14:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@atjson/document"),e=d(t),n=require("@atjson/renderer-webcomponent"),i=d(n),a=require("./mixins/events"),o=d(a);function d(t){return t&&t.__esModule?t:{default:t}}require("./selection-toolbar"),require("./text-input"),require("./text-selection");class s extends o.default{constructor(){super(),this.document=new e.default(""),this.selection={start:0,end:0}}get value(){return this.document}scheduleRender(){window.requestAnimationFrame(()=>{let t=this.querySelector(".editor");if(null!==t){this.render(t);let e=new CustomEvent("change",{bubbles:!0,composed:!0,detail:{document:this.document}});this.dispatchEvent(e)}})}render(t){if(!t)return;let e=new i.default(this.document).render();if(e.innerHTML!==t.innerHTML&&(t.innerHTML=e.innerHTML,this.selection)){let t=this.querySelector("text-selection");t&&t.setSelection(this.selection)}}setDocument(t){this.document=t,this.document.where({}).update(t=>{null==t.id&&(t.id=Math.floor(Math.random()*Number.MAX_SAFE_INTEGER))}),this.document.addEventListener("change",()=>this.scheduleRender())}addContentFeature(t){this.selectionToolbar.appendChild(t.selectionButton),t.annotationName&&(i.default.prototype[t.annotationName]=t.elementRenderer)}getSelection(){return this.querySelector("text-selection")}get selectionToolbar(){let t=this.querySelector("selection-toolbar");if(!t)throw new Error("Could not find selection-toolbar.");if(!t.shadowRoot)throw new Error("Expected selectionToolbar to have shadowRoot.");return t}connectedCallback(){this.innerHTML=s.template,super.connectedCallback(),this.render(this.querySelector(".editor"))}handleTextSelectionChange(t){this.selection=t.detail;let e=this.document.annotations.filter(e=>e.start<=t.detail.start&&e.end>=t.detail.start||e.start<=t.detail.end&&e.end>=t.detail.end),n=new CustomEvent("selectionchange",{detail:Object.assign({selectedAnnotations:e,document:this.document},t.detail),bubbles:!1}),i=this.querySelector("selection-toolbar");i&&i.dispatchEvent(n)}handleTextInsert(t){this.document.insertText(t.detail.position,t.detail.text),this.selection.start+=t.detail.text.length,this.selection.end+=t.detail.text.length}handleTextDelete(t){let e=t.detail;if(this.document.deleteText(e),this.selection.start<e.start);else if(this.selection.start<e.end)this.selection.start=this.selection.end=e.start;else{let t=e.end-e.start;this.selection.start-=t,this.selection.end-=t}}handleTextReplace(t){let e=t.detail;this.document.deleteText(e),this.document.insertText(e.start,e.text),this.selection.start=e.start+e.text.length}handleAnnotationAdd(t){if("bold"===t.detail.type||"italic"===t.detail.type){const e=(t,e)=>t.start>=e.start&&t.end<=e.end,n=(t,e)=>t.start<=e.end&&t.end>=e.start;let i=this.document.annotations.filter(e=>e.type===t.detail.type).filter(i=>e(i,t.detail)||e(t.detail,i)||n(i,t.detail)||n(t.detail,i)),a=i.reduce((t,e)=>Math.min(t,e.start),this.document.content.length),o=i.reduce((t,e)=>Math.max(t,e.end),0);if(0===i.length)this.document.addAnnotations(t.detail);else if(a<=t.detail.start&&t.detail.end<=o&&1===i.length){let e=i[0],n=Object.assign({},e,t.detail,{start:e.start,end:t.detail.start}),d=Object.assign({},e,t.detail,{start:t.detail.end,end:e.end});a!==t.detail.start&&this.document.addAnnotations(n),o!==t.detail.end&&this.document.addAnnotations(d)}else this.document.addAnnotations(Object.assign({},i[0],t.detail,{start:Math.min(a,t.detail.start),end:Math.max(o,t.detail.end)}));i.forEach(t=>this.document.removeAnnotation(t))}else this.document.addAnnotations(t.detail)}handleAnnotationDelete(t){let e=this.document.annotations.find(e=>e.id===t.detail.annotationId);e&&this.document.removeAnnotation(e)}handleAttributeChange(t){if(t.detail.annotationId){let e=this.document.annotations.find(e=>e.id===t.detail.annotationId);if(e){let n=Object.assign(e,{attributes:t.detail.attributes});this.document.replaceAnnotation(e,n)}}else if(t.target instanceof Element){let e=t.target.getAttribute("data-annotation-id"),n=this.document.annotations.find(t=>void 0!==t.id&&t.id.toString()===e);n&&this.document.replaceAnnotation(n,Object.assign(n,t.detail))}}}exports.default=s,s.template='<text-input><text-selection><selection-toolbar slot="toolbar"></selection-toolbar><div class="editor" style="white-space: pre-wrap" contenteditable></div></text-selection></text-input>',s.events={"change text-selection":"handleTextSelectionChange","insertText text-input":"handleTextInsert","deleteText text-input":"handleTextDelete","replaceText text-input":"handleTextReplace",addAnnotation:"handleAnnotationAdd",deleteAnnotation:"handleAnnotationDelete",attributechange:"handleAttributeChange"},window.customElements.get("offset-editor")||window.customElements.define("offset-editor",s);
},{"@atjson/document":13,"@atjson/renderer-webcomponent":51,"./mixins/events":26,"./selection-toolbar":23,"./text-input":24,"./text-selection":25}],27:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});class e{static elementRenderer(){return document.createElement("blockquote")}}exports.default=e,e.annotationName="blockquote";
},{}],28:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});class e{static elementRenderer(){return document.createElement("strong")}}exports.default=e,e.annotationName="bold";
},{}],64:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../mixins/component"),t=n(e);function n(e){return e&&e.__esModule?e:{default:e}}class i extends t.default{getOverlappingHeading(){return this.selection.selectedAnnotations.find(e=>"heading"===e.type)}onSelectionChange(e){let{start:t,end:n,document:i}=e.detail,s=!1;if(t!==n){let e=i.content.slice(t,n).lastIndexOf("\n");s=-1===e||e===n-1}if(this.shadowRoot)if(s){this.selection=e.detail;let t=this.getOverlappingHeading(),n=this.shadowRoot.querySelector(".level"),i=this.shadowRoot.querySelector(".toggle");if(!n||!i)return;if(t){i.textContent="H"+t.attributes.level,this.classList.add("active");let e=parseInt(t.attributes.level,10)+1;e<4?(n.textContent="H"+e,n.classList.remove("hidden")):n.classList.add("hidden")}else i.textContent="H1",n.classList.add("hidden"),this.classList.remove("active");this.style.display="initial"}else delete this.selection,e.preventDefault(),this.style.display="none"}onToggleClick(){let e=this.getOverlappingHeading();if(e)this.dispatchEvent(new CustomEvent("deleteAnnotation",{bubbles:!0,composed:!0,detail:{annotationId:e.id}})),this.dispatchEvent(new CustomEvent("addAnnotation",{bubbles:!0,composed:!0,detail:{type:"paragraph",start:e.start,end:e.end}}));else{let e=this.selection.document.content,t=Math.max(0,e.lastIndexOf("\n",parseInt(this.selection.start,10))),n=e.indexOf("\n",parseInt(this.selection.end,10));-1===n&&(n=e.length),this.dispatchEvent(new CustomEvent("addAnnotation",{bubbles:!0,composed:!0,detail:{type:"heading",start:t,end:n,attributes:{level:1}}}))}}onLevelClick(){let e=this.getOverlappingHeading(),t=parseInt(e.attributes.level,10)+1;this.dispatchEvent(new CustomEvent("attributechange",{bubbles:!0,composed:!0,detail:{annotationId:e.id,attributes:Object.assign(e.attributes,{level:t})}}))}}exports.default=i,i.template='<button class="toggle">H</button><button class="level"></button>',i.style="\n    :host(.active) .toggle {\n      border-color: red;\n      font-weight: bold;\n    }\n\n    .level {\n      display: none;\n    }\n\n    :host(.active) .level {\n      display: initial;\n    }\n\n    :host(.active) .level.hidden {\n      display: none;\n    }\n  ",i.events={selectionchange:"onSelectionChange","click .toggle":"onToggleClick","click .level":"onLevelClick"},window.customElements.get("offset-heading-action-button")||window.customElements.define("offset-heading-action-button",i);
},{"../mixins/component":61}],29:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),require("./heading-action-button");class e{static elementRenderer(e){return document.createElement("h"+e.attributes.level)}static get selectionButton(){return document.createElement("offset-heading-action-button")}}exports.default=e,e.annotationName="heading";
},{"./heading-action-button":64}],30:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});class e{static elementRenderer(){return document.createElement("em")}}exports.default=e,e.annotationName="italic";
},{}],36:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("./component"),e=n(t);function n(t){return t&&t.__esModule?t:{default:t}}class o extends e.default{static get selectionButton(){let t=document.createElement("button");return t.setAttribute("data-type",this.annotationName),t.innerHTML=this.annotationName,t}static elementRenderer(t){let e=document.createElement("div");return e.setAttribute("data-type",t.type),e}cursorFocus(){this.classList.add("cursorfocus")}cursorBlur(){this.classList.remove("cursorfocus")}}exports.default=o,o.style="\n    :host {\n      position: relative;\n      outline: none;\n    }\n\n    @keyframes showControls {\n      from { opacity: 0; }\n      to { opacity: 1; }\n    }\n\n    .controls {\n      position: absolute;\n      top: -2.5em;\n      left: 0;\n      height: 1.5em;\n      vertical-align: baseline;\n      background-color: white;\n      padding: 3px;\n      border: 1px solid black;\n      white-space: normal;\n    }\n\n    :host(:not(.cursorfocus)) .controls {\n      display: none;\n    }\n\n    :host(.cursorfocus) .controls {\n      animation: showControls 200ms ease-in-out both;\n      display: flex;\n    }",o.events={cursorfocus:"cursorFocus",cursorblur:"cursorBlur"};
},{"./component":61}],65:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../mixins/component"),o=e(t);function e(t){return t&&t.__esModule?t:{default:t}}class n extends o.default{onConfig(){this.classList.toggle("config")}beforeInput(t){t.stopPropagation()}handleKeypress(t){13===t.keyCode&&this.onSave(t)}onSave(t){this.setAttribute("url",this.urlInput.value),this.nofollowInput.checked?this.setAttribute("nofollow",""):this.removeAttribute("nofollow"),this.dispatchEvent(new CustomEvent("attributechange",{bubbles:!0,composed:!0,detail:{attributes:{url:this.urlInput.value,nofollow:this.nofollowInput.checked}}})),this.dispatchEvent(new CustomEvent("resumeinput",{bubbles:!0,composed:!0})),t.stopPropagation()}attributeChangedCallback(t){switch(t){case"url":this.urlInput.setAttribute("value",this.getAttribute("url")||"");break;case"nofollow":this.nofollowInput.checked=this.hasAttribute("nofollow")}}get urlInput(){if(!this.shadowRoot)throw new Error("No shadowRoot found!");let t=this.shadowRoot.querySelector(".urlinput");if(!t)throw new Error("No URL Input Element Found!");return t}get nofollowInput(){if(!this.shadowRoot)throw new Error("No shadowRoot found!");let t=this.shadowRoot.querySelector(".nofollow");if(!t)throw new Error("No nofollow Input Element Found!");return t}}exports.default=n,n.template='<a target="_blank">🔗</a>&nbsp;<div class="default"><input type="text" class="urlinput" /></div><div class="extended"><input type="checkbox" name="nofollow" class="nofollow" /><label for="nofollow">No&nbsp;Follow</label></div>&nbsp; <button class="config">⚙️</button><button class="cancel">❌</button><button class="save">✔️</button>&nbsp;',n.events={beforeinput:"beforeInput","click .cancel":"cursorBlur","click .save":"onSave","click .config":"onConfig","keypress .urlinput":"handleKeypress"},n.observedAttributes=["url","nofollow"],n.style="\n    :host {\n      display: flex;\n    }\n\n    .extended {\n      display: none;\n      width: max-content;\n    }\n\n    :host(.config) .default {\n      display: none;\n    }\n\n    :host(.config) .extended {\n      display: block;\n    }\n\n    :host(.config) button.config {\n      background: darkgrey;\n    }\n  ",window.customElements.get("link-editor")||window.customElements.define("link-editor",n);
},{"../mixins/component":61}],31:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../mixins/editable-component"),e=o(t);function o(t){return t&&t.__esModule?t:{default:t}}require("./link-editor");class l extends e.default{static elementRenderer(t){let e=document.createElement("offset-link");return e.setAttribute("url",t.attributes.url),t.attributes.nofollow&&e.setAttribute("nofollow",""),e}cancelLinkClick(t){t.preventDefault()}attributeChangedCallback(t){if(!this.shadowRoot)throw new Error("No shadowRoot found!");let e=this.shadowRoot.querySelector("a"),o=this.shadowRoot.querySelector("link-editor");if(!e)throw new Error("No link (a) element found!");if(!o)throw new Error("No link-editor element found");switch(t){case"url":e.setAttribute("href",this.getAttribute("url")||""),o.setAttribute("url",this.getAttribute("url")||"");break;case"nofollow":this.hasAttribute("nofollow")?o.setAttribute("nofollow",""):o.removeAttribute("nofollow")}}}exports.default=l,l.template='<div class="controls"><link-editor></link-editor></div><a class="link" target="_blank"><slot></slot></a>',l.observedAttributes=["url","nofollow"],l.style=e.default.style+"\n    a {\n      text-decoration: underline;\n      color: blue;\n      cursor: text;\n    }\n  ",l.events=Object.assign({"click .link":"cancelLinkClick"},e.default.events),l.annotationName="link",window.customElements.get("offset-link")||window.customElements.define("offset-link",l);
},{"../mixins/editable-component":36,"./link-editor":65}],32:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});class e{static elementRenderer(){return document.createElement("p")}}exports.default=e,e.annotationName="paragraph";
},{}],33:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});class e{static elementRenderer(){return document.createElement("del")}}exports.default=e,e.annotationName="strikethrough";
},{}],34:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../mixins/editable-component"),t=n(e);function n(e){return e&&e.__esModule?e:{default:e}}class r extends t.default{}exports.default=r,r.annotationName="superscript",r.elementRenderer=(()=>document.createElement("sup"));
},{"../mixins/editable-component":36}],35:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});class e{static elementRenderer(){return document.createElement("u")}}exports.default=e,e.annotationName="underline";
},{}],15:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./mixins/editable-component");Object.keys(e).forEach(function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})});var t=require("./components/blockquote"),r=g(t),u=require("./components/bold"),n=g(u),o=require("./components/heading"),i=g(o),l=require("./components/italic"),a=g(l),s=require("./components/link"),c=g(s),d=require("./components/paragraph"),p=g(d),f=require("./components/strikethrough"),m=g(f),q=require("./components/superscript"),b=g(q),_=require("./components/underline"),h=g(_);function g(e){return e&&e.__esModule?e:{default:e}}let k=[r.default,n.default,i.default,a.default,c.default,p.default,m.default,b.default,h.default];exports.default=k;
},{"./components/blockquote":27,"./components/bold":28,"./components/heading":29,"./components/italic":30,"./components/link":31,"./components/paragraph":32,"./components/strikethrough":33,"./components/superscript":34,"./components/underline":35,"./mixins/editable-component":36}],95:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@atjson/document");class t extends e.BlockAnnotation{}exports.default=t,t.type="blockquote",t.vendorPrefix="offset";
},{"@atjson/document":13}],96:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@atjson/document");class t extends e.InlineAnnotation{}exports.default=t,t.type="bold",t.vendorPrefix="offset";
},{"@atjson/document":13}],97:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@atjson/document");class t extends e.Annotation{get rank(){return"inline"===this.attributes.style?100:10}}exports.default=t,t.vendorPrefix="offset",t.type="code";
},{"@atjson/document":13}],103:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.without=t;var e=require("@atjson/document");function t(e,t){return e.reduce((e,r)=>(r!==t&&e.push(r),e),[])}class r extends e.ObjectAnnotation{get url(){try{return new URL(this.attributes.url)}catch(e){return null}}}exports.default=r,r.type="iframe-embed",r.vendorPrefix="offset";
},{"@atjson/document":13}],98:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./iframe-embed"),t=r(e);function r(e){return e&&e.__esModule?e:{default:e}}class d extends t.default{}exports.default=d,d.type="facebook-embed",d.vendorPrefix="offset";
},{"./iframe-embed":103}],99:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./iframe-embed"),t=r(e);function r(e){return e&&e.__esModule?e:{default:e}}class u extends t.default{get giphyId(){let t=this.url;return t?(0,e.without)(t.pathname.split("/"),"")[1]:null}}exports.default=u,u.type="giphy-embed",u.vendorPrefix="offset";
},{"./iframe-embed":103}],100:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@atjson/document");class t extends e.BlockAnnotation{}exports.default=t,t.type="heading",t.vendorPrefix="offset";
},{"@atjson/document":13}],101:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@atjson/document");class t extends e.ObjectAnnotation{}exports.default=t,t.vendorPrefix="offset",t.type="horizontal-rule";
},{"@atjson/document":13}],102:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@atjson/document");class t extends e.Annotation{get rank(){return"inline"===this.attributes.style?100:10}}exports.default=t,t.vendorPrefix="offset",t.type="html";
},{"@atjson/document":13}],106:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@atjson/document");class t extends e.InlineAnnotation{}exports.default=t,t.type="italic",t.vendorPrefix="offset";
},{"@atjson/document":13}],107:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@atjson/document");class t extends e.ObjectAnnotation{}exports.default=t,t.vendorPrefix="offset",t.type="line-break";
},{"@atjson/document":13}],108:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@atjson/document");class t extends e.InlineAnnotation{}exports.default=t,t.type="link",t.vendorPrefix="offset";
},{"@atjson/document":13}],114:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@atjson/document");class t extends e.InlineAnnotation{}exports.default=t,t.type="strikethrough",t.vendorPrefix="offset";
},{"@atjson/document":13}],115:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@atjson/document");class t extends e.InlineAnnotation{}exports.default=t,t.type="subscript",t.vendorPrefix="offset";
},{"@atjson/document":13}],116:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@atjson/document");class t extends e.InlineAnnotation{}exports.default=t,t.type="superscript",t.vendorPrefix="offset";
},{"@atjson/document":13}],118:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@atjson/document");class t extends e.InlineAnnotation{}exports.default=t,t.type="underline",t.vendorPrefix="offset";
},{"@atjson/document":13}],104:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ImageDescriptionSource=void 0;var e=require("@atjson/document"),t=j(e),r=require("./bold"),u=j(r),i=require("./code"),s=j(i),o=require("./italic"),a=j(o),d=require("./line-break"),n=j(d),l=require("./link"),c=j(l),f=require("./strikethrough"),p=j(f),q=require("./subscript"),m=j(q),x=require("./superscript"),b=j(x),g=require("./underline"),v=j(g);function j(e){return e&&e.__esModule?e:{default:e}}class _ extends t.default{}exports.ImageDescriptionSource=_,_.contentType="application/vnd.atjson+offset;image.description",_.schema=[u.default,s.default,a.default,n.default,c.default,p.default,m.default,b.default,v.default];class h extends e.ObjectAnnotation{}exports.default=h,h.vendorPrefix="offset",h.type="image",h.subdocuments={description:_};
},{"@atjson/document":13,"./bold":96,"./code":97,"./italic":106,"./line-break":107,"./link":108,"./strikethrough":114,"./subscript":115,"./superscript":116,"./underline":118}],105:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./iframe-embed"),t=r(e);function r(e){return e&&e.__esModule?e:{default:e}}class s extends t.default{get shortcode(){let t=this.url;return t?(0,e.without)(t.pathname.split("/"),"")[1]:null}get isCaptioned(){let t=this.url;return!!t&&"captioned"===(0,e.without)(t.pathname.split("/"),"")[3]}set isCaptioned(e){let t=this.url;t&&(t.pathname=e?`/p/${this.shortcode}/embed/captioned`:`/p/${this.shortcode}/embed`,this.attributes.url=t.toString())}}exports.default=s,s.type="instagram-embed",s.vendorPrefix="offset";
},{"./iframe-embed":103}],109:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@atjson/document");class t extends e.BlockAnnotation{}exports.default=t,t.vendorPrefix="offset",t.type="list";
},{"@atjson/document":13}],110:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@atjson/document");class t extends e.BlockAnnotation{}exports.default=t,t.vendorPrefix="offset",t.type="list-item";
},{"@atjson/document":13}],111:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@atjson/document");class r extends e.BlockAnnotation{get rank(){return 3*super.rank/2}}exports.default=r,r.type="paragraph",r.vendorPrefix="offset";
},{"@atjson/document":13}],112:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("./iframe-embed"),e=i(t);function i(t){return t&&t.__esModule?t:{default:t}}class r extends e.default{get isPin(){let e=this.url;return!!e&&"pin"===(0,t.without)(e.pathname.split("/"),"")[0]}get isProfile(){let e=this.url;return!!e&&(!this.isPin&&2===(0,t.without)(e.pathname.split("/"),"").length)}get isBoard(){let e=this.url;return!!e&&1===(0,t.without)(e.pathname.split("/"),"").length}get pinId(){let e=this.url;return this.isPin&&e?(0,t.without)(e.pathname.split("/"),"")[1]:null}get profileName(){let e=this.url;return!this.isPin&&e?(0,t.without)(e.pathname.split("/"),"")[0]:null}}exports.default=r,r.type="pinterest-embed",r.vendorPrefix="offset";
},{"./iframe-embed":103}],113:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@atjson/document");class t extends e.BlockAnnotation{}exports.default=t,t.type="pullquote",t.vendorPrefix="offset";
},{"@atjson/document":13}],117:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./iframe-embed"),t=r(e);function r(e){return e&&e.__esModule?e:{default:e}}class u extends t.default{get tweetBy(){let t=this.url;return t?(0,e.without)(t.pathname.split("/"),"")[0]:null}get tweetId(){let t=this.url;return t?(0,e.without)(t.pathname.split("/"),"")[2]:null}}exports.default=u,u.type="twitter-embed",u.vendorPrefix="offset";
},{"./iframe-embed":103}],119:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("./iframe-embed"),e=r(t);function r(t){return t&&t.__esModule?t:{default:t}}class s extends e.default{get videoId(){let e=this.url;return e?(0,t.without)(e.pathname.split("/"),"")[1]:null}get startsAt(){let t=this.url;return t?parseInt(t.searchParams.get("t")||"0",10):0}set startsAt(t){let e=this.url;e&&(0===t?e.searchParams.delete("t"):e.searchParams.set("t",t.toString()),this.attributes.url=e.toString())}get isPlayerInfoShown(){let t=this.url;return!!t&&"0"===t.searchParams.get("showinfo")}set isPlayerInfoShown(t){let e=this.url;e&&(t?e.searchParams.delete("showinfo"):e.searchParams.set("showinfo","0"),this.attributes.url=e.toString())}get areRelatedVideosShown(){let t=this.url;return!!t&&"0"===t.searchParams.get("rel")}set areRelatedVideosShown(t){let e=this.url;e&&(t?e.searchParams.delete("rel"):e.searchParams.set("rel","0"),this.attributes.url=e.toString())}get areControlsShown(){let t=this.url;return!!t&&"0"===t.searchParams.get("controls")}set areControlsShown(t){let e=this.url;e&&(t?e.searchParams.delete("controls"):e.searchParams.set("controls","0"),this.attributes.url=e.toString())}get isUsingCookielessDomain(){let t=this.url;return!!t&&"www.youtube-nocookie.com"===t.host}set isUsingCookielessDomain(t){let e=this.url;e&&(e.host=t?"www.youtube-nocookie.com":"www.youtube.com",this.attributes.url=e.toString())}}exports.default=s,s.type="youtube-embed",s.vendorPrefix="offset";
},{"./iframe-embed":103}],92:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./blockquote");Object.defineProperty(exports,"Blockquote",{enumerable:!0,get:function(){return k(e).default}});var r=require("./bold");Object.defineProperty(exports,"Bold",{enumerable:!0,get:function(){return k(r).default}});var t=require("./code");Object.defineProperty(exports,"Code",{enumerable:!0,get:function(){return k(t).default}});var u=require("./facebook-embed");Object.defineProperty(exports,"FacebookEmbed",{enumerable:!0,get:function(){return k(u).default}});var n=require("./giphy-embed");Object.defineProperty(exports,"GiphyEmbed",{enumerable:!0,get:function(){return k(n).default}});var i=require("./heading");Object.defineProperty(exports,"Heading",{enumerable:!0,get:function(){return k(i).default}});var o=require("./horizontal-rule");Object.defineProperty(exports,"HorizontalRule",{enumerable:!0,get:function(){return k(o).default}});var a=require("./html");Object.defineProperty(exports,"HTML",{enumerable:!0,get:function(){return k(a).default}});var f=require("./iframe-embed");Object.defineProperty(exports,"IframeEmbed",{enumerable:!0,get:function(){return k(f).default}});var d=require("./image");Object.defineProperty(exports,"Image",{enumerable:!0,get:function(){return k(d).default}}),Object.defineProperty(exports,"ImageDescriptionSource",{enumerable:!0,get:function(){return d.ImageDescriptionSource}});var b=require("./instagram-embed");Object.defineProperty(exports,"InstagramEmbed",{enumerable:!0,get:function(){return k(b).default}});var l=require("./italic");Object.defineProperty(exports,"Italic",{enumerable:!0,get:function(){return k(l).default}});var c=require("./line-break");Object.defineProperty(exports,"LineBreak",{enumerable:!0,get:function(){return k(c).default}});var p=require("./link");Object.defineProperty(exports,"Link",{enumerable:!0,get:function(){return k(p).default}});var m=require("./list");Object.defineProperty(exports,"List",{enumerable:!0,get:function(){return k(m).default}});var s=require("./list-item");Object.defineProperty(exports,"ListItem",{enumerable:!0,get:function(){return k(s).default}});var g=require("./paragraph");Object.defineProperty(exports,"Paragraph",{enumerable:!0,get:function(){return k(g).default}});var y=require("./pinterest-embed");Object.defineProperty(exports,"PinterestEmbed",{enumerable:!0,get:function(){return k(y).default}});var P=require("./pullquote");Object.defineProperty(exports,"Pullquote",{enumerable:!0,get:function(){return k(P).default}});var q=require("./strikethrough");Object.defineProperty(exports,"Strikethrough",{enumerable:!0,get:function(){return k(q).default}});var j=require("./subscript");Object.defineProperty(exports,"Subscript",{enumerable:!0,get:function(){return k(j).default}});var x=require("./superscript");Object.defineProperty(exports,"Superscript",{enumerable:!0,get:function(){return k(x).default}});var O=require("./twitter-embed");Object.defineProperty(exports,"TwitterEmbed",{enumerable:!0,get:function(){return k(O).default}});var v=require("./underline");Object.defineProperty(exports,"Underline",{enumerable:!0,get:function(){return k(v).default}});var h=require("./youtube-embed");function k(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(exports,"YouTubeEmbed",{enumerable:!0,get:function(){return k(h).default}});
},{"./blockquote":95,"./bold":96,"./code":97,"./facebook-embed":98,"./giphy-embed":99,"./heading":100,"./horizontal-rule":101,"./html":102,"./iframe-embed":103,"./image":104,"./instagram-embed":105,"./italic":106,"./line-break":107,"./link":108,"./list":109,"./list-item":110,"./paragraph":111,"./pinterest-embed":112,"./pullquote":113,"./strikethrough":114,"./subscript":115,"./superscript":116,"./twitter-embed":117,"./underline":118,"./youtube-embed":119}],77:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./annotations");Object.keys(e).forEach(function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(exports,t,{enumerable:!0,get:function(){return e[t]}})});var t=require("@atjson/document"),r=o(t);function o(e){return e&&e.__esModule?e:{default:e}}class n extends r.default{}exports.default=n,n.contentType="application/vnd.atjson+offset",n.schema=[e.Blockquote,e.Bold,e.Code,e.FacebookEmbed,e.GiphyEmbed,e.Heading,e.HorizontalRule,e.HTML,e.Image,e.InstagramEmbed,e.Italic,e.LineBreak,e.Link,e.List,e.ListItem,e.Paragraph,e.PinterestEmbed,e.Pullquote,e.Strikethrough,e.Subscript,e.Superscript,e.TwitterEmbed,e.Underline,e.YouTubeEmbed];
},{"@atjson/document":13,"./annotations":92}],78:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.escapeHTML=n;var t=require("@atjson/hir");const e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;","=":"&#x3D;"};function n(t){return t.replace(/[&<>"'`=]/g,t=>e[t])}function r(t){let e=[];for(let n=0,o=t.length;n<o;n++){let o=t[n];Array.isArray(o)?e.push(...r(o)):null!=o&&e.push(o)}return e}function o(e,n,a,l,i){let u,s=n.annotation,c=n.children(),d=c.map(t=>t.annotation),p=(u=null==a?e.root():e.renderAnnotation(s,{parent:a,previous:l||null,next:i||null,children:d})).next();return p.done?p.value:u.next(r(c.map((n,r)=>n.annotation instanceof t.TextAnnotation?e.text(n.annotation.attributes.text):o(e,n,s,d[r-1],d[r+1])))).value}class a{*renderAnnotation(t,e){let n=this[t.type];return n?yield*n.call(this,t,e):yield}*root(){return yield}text(t){return t}render(e){return e instanceof t.HIR?o(this,e.rootNode):o(this,new t.HIR(e).rootNode)}}exports.default=a;
},{"@atjson/hir":71}],68:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.split=s;var t=require("@atjson/offset-annotations"),e=require("@atjson/renderer-hir"),i=r(e);function r(t){return t&&t.__esModule?t:{default:t}}function*s(){let t,e=(yield).join(""),i=0,r=e.length;for(;i<r&&(t=e.slice(i).match(/^(\s|&nbsp;){1}/));)i+=t[1].length;for(;r>i&&(t=e.slice(0,r).match(/(\s|&nbsp;){1}$/));)r-=t[1].length;return[e.slice(0,i),e.slice(i,r),e.slice(r)]}function n(t){return t.replace(/([#!*+=\\\[\]\^_`{|}~])/g,"\\$1").replace(/(\d+)\./g,"$1\\.").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/(^[\s]*)-/g,"$1\\-").replace(/(\r\n|\r|\n)([\s]*)-/g,"$1$2\\-")}function l(t){return t.replace(/\(/g,"\\(").replace(/\)/g,"\\)")}function a(t){let e=0,i=[0];for(let r=0,s=t.length;r<s;r++)"`"===t[r]?i[e]=i[e]+1:0!==i[e]&&(i.push(0),e++);return i.sort().reduce((t,e)=>e===t?t+1:t,1)}class u extends i.default{constructor(){super(),this.state={}}text(t){return this.state.isPreformatted?t:n(t).replace(/\u00A0/gu,"&nbsp;")}*root(){return(yield).join("")}*bold(e,i){let[r,n,l]=yield*s();return 0===n.length?r+l:!i.previous&&!i.next&&i.parent instanceof t.Italic?`${r}__${n}__${l}`:`${r}**${n}**${l}`}*blockquote(){let t=(yield).join("").split("\n"),e=t.length,i=0;for(;i<e-1&&t[i].match(/^\s*$/);)i++;for(;e>i+1&&t[e-1].match(/^\s*$/);)e--;let r=t.slice(i,e).map(t=>`> ${t}`).join("\n")+"\n";return this.state.tight||(r+="\n"),r}*heading(t){let e=(yield).join(""),i=new Array(t.attributes.level+1).join("#");if(-1!==e.indexOf("\n")){if(1===t.attributes.level)return`${e}\n====\n`;if(2===t.attributes.level)return`${e}\n----\n`}return`${i} ${e}\n`}*"horizontal-rule"(){return"***\n"}*image(t){if(t.attributes.title){let e=t.attributes.title.replace(/"/g,'\\"');return`![${this.render(t.attributes.description)}](${t.attributes.url} "${e}")`}return`![${this.render(t.attributes.description)}](${t.attributes.url})`}*italic(e,i){let r=Object.assign({},this.state);this.state.isItalicized=!0;let[n,l,a]=yield*s();if(this.state=r,0===l.length)return n+a;{let e=r.isItalicized?"_":"*",s=!i.previous&&!i.next&&i.parent instanceof t.Bold,u=i.next instanceof t.Bold&&0===a.length||i.previous instanceof t.Bold&&0===n.length;return(s||u)&&(e="_"),`${n}${e}${l}${e}${a}`}}*"line-break"(){return"  \n"}*link(t){let[e,i,r]=yield*s(),n=l(t.attributes.url);if(t.attributes.title){return`${e}[${i}](${n} "${t.attributes.title.replace(/"/g,'\\"')}")${r}`}return`${e}[${i}](${n})${r}`}*code(t,e){let i=Object.assign({},this.state);Object.assign(this.state,{isPreformatted:!0,htmlSafe:!0});let r=(yield).join("");if(this.state=i,"fence"===t.attributes.style){r="\n"+r;let i=t.attributes.info||"",s="\n";return this.state.isList&&e.next&&(s+="\n"),-1!==r.indexOf("```")?`~~~${i}${r}~~~${s}`:`\`\`\`${i}${r}\`\`\`${s}`}if("block"===t.attributes.style)return r.split("\n").map(t=>`    ${t}`).join("\n")+"\n";if(0===r.length)return"` `";{let t="`".repeat(a(r));return`${t}${r}${t}`}}*html(t){let e=Object.assign({},this.state);Object.assign(this.state,{isPreformatted:!0,htmlSafe:!0});let i=(yield).join("");return this.state=e,"block"===t.attributes.style?i+"\n":i}*"list-item"(){let t=this.state.digit,e=this.state.delimiter,i=e;"numbered"===this.state.type&&(i=`${t}${e}`,this.state.digit++);let r=" ".repeat(i.length+1),s=(yield).join(""),n=0;for(;" "===s[n];)n++;let l=s.split("\n");l.push((l.pop()||"").replace(/[ ]+$/,"")),l.unshift((l.shift()||"").replace(/^[ ]+/,""));let[a,...u]=l;return s=" ".repeat(n)+a+"\n"+u.map(t=>r+t).join("\n").replace(/[ ]+$/,""),this.state.tight&&(s=s.replace(/([ \n])+$/,"\n")),this.state.hasCodeBlockFollowing?` ${i}    ${s}`:`${i} ${s}`}*list(e,i){let r=1;null!=e.attributes.startsAt&&(r=e.attributes.startsAt);let s="";"numbered"===e.attributes.type?(s=".",i.previous instanceof t.List&&"numbered"===i.previous.attributes.type&&"."===i.previous.attributes.delimiter&&(s=")")):"bulleted"===e.attributes.type&&(s="-",i.previous instanceof t.List&&"bulleted"===i.previous.attributes.type&&"-"===i.previous.attributes.delimiter&&(s="+")),e.attributes.delimiter=s;let n=Object.assign({},this.state),l=i.next instanceof t.Code&&"block"===i.next.attributes.style;Object.assign(this.state,{isList:!0,type:e.attributes.type,digit:r,delimiter:s,tight:e.attributes.tight,hasCodeBlockFollowing:l});let a=yield;return this.state=n,a.join("")+"\n"}*paragraph(){let t=(yield).join("");return t.match(/^\s+$/g)||(t=t.replace(/^\s+/g,"").replace(/\s+$/g,"")),this.state.tight?t+"\n":t+"\n\n"}}exports.default=u;
},{"@atjson/offset-annotations":77,"@atjson/renderer-hir":78}],87:[function(require,module,exports) {
"use strict";var e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});const t=e(require("../../src/mixins/component"));class n extends t.default{attributeChangedCallback(e){switch(e){case"name":this.shadowRoot.querySelector(".name").innerHTML=this.getAttribute("name");break;case"value":this.shadowRoot.querySelector(".value").innerHTML=this.getAttribute("value")}}}n.template='<div class="attribute"><span class="name"></span>: "<span class="value"></span>"</div>',n.style="\n    .attribute {\n      padding: 0;\n      margin: 0;\n    }\n\n    .name {\n      padding-left: 1em;\n      color: rgb(153, 69, 0);\n    }\n\n    .value {\n      color: rgb(26, 26, 166);\n    }\n  ",n.observedAttributes=["name","value"],exports.default=n,window.customElements.get("annotation-attribute")||window.customElements.define("annotation-attribute",n);
},{"../../src/mixins/component":61}],88:[function(require,module,exports) {
"use strict";var t=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0});const e=t(require("../../src/mixins/component"));require("./annotation-attribute");class n extends e.default{attributeChangedCallback(t){switch(t){case"type":this.shadowRoot.querySelector(".type").innerHTML=this.getAttribute("type");break;case"start":this.shadowRoot.querySelector(".start").innerHTML=this.getAttribute("start");break;case"end":this.shadowRoot.querySelector(".end").innerHTML=this.getAttribute("end")}}}n.template='\n    <div class="annotation">\n      <span class="type"></span>\n      {<span class="attributes"><slot></slot></span>}\n      <div class="position">\n        [<div class="start"></div>,&nbsp;<div class="end"></div>]\n      </div>\n    </div>\n  ',n.style="\n    :host {\n      font-family: Consolas, Lucida Console, Courier New, monospace;\n      width: 100%;\n    }\n\n    .annotation {\n      padding: 1ex;\n      border-bottom: 1px solid #ccc;\n      position: relative;\n    }\n\n    .type {\n      color: rgb(136, 18, 128);\n    }\n\n    .position {\n      position: absolute;\n      top: 1ex;\n      right: 1ex;\n      display: flex;\n      flex-direction: row;\n    }\n  ",n.observedAttributes=["type","start","end"],exports.default=n,window.customElements.get("annotation-inspector")||window.customElements.define("annotation-inspector",n);
},{"../../src/mixins/component":61,"./annotation-attribute":87}],73:[function(require,module,exports) {
"use strict";var t=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0});const e=t(require("../../src/mixins/component"));require("./annotation-attribute"),require("./annotation-inspector");class o extends e.default{updateBody(){let t={};this.document.annotations.forEach(e=>{let o=e.id.toString(),n=this.shadowRoot.querySelector(`[id="${o}"]`);t[o]=n}),this.shadowRoot.childNodes.forEach(e=>{t[e.getAttribute("id")]||this.shadowRoot.removeChild(e)}),this.document.annotations.sort((t,e)=>t.start-e.start).forEach(e=>{let o;t[e.id.toString()]?o=t[e.id.toString()]:((o=document.createElement("annotation-inspector")).setAttribute("id",e.id),this.shadowRoot.appendChild(o)),o.setAttribute("type",e.type),o.setAttribute("start",e.start),o.setAttribute("end",e.end),e.attributes&&Object.keys(e.attributes).forEach(t=>{let n=o.querySelector(`[name="${t}"]`);null===n&&((n=document.createElement("annotation-attribute")).setAttribute("name",t),o.appendChild(n)),n.setAttribute("value",e.attributes[t])})})}setDocument(t){this.document!==t&&(this.document=t,this.document.addEventListener("change",()=>{this._updateCallback||(this._updateCallback=(()=>{this.updateBody(),setTimeout(()=>{delete this._updateCallback},0)}),window.requestIdleCallback(this._updateCallback))}))}}o.template="",o.style="\n    .container {\n      overflow-y: scroll;\n      position: relative;\n      max-height: 100%;\n    }\n  ",exports.default=o,window.customElements.get("annotations-inspector")||window.customElements.define("annotations-inspector",o);
},{"../../src/mixins/component":61,"./annotation-attribute":87,"./annotation-inspector":88}],74:[function(require,module,exports) {
"use strict";var e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});const t=e(require("../../src/mixins/component"));class n extends t.default{updateContent(){const e=parseInt(this.getAttribute("start"),10),t=parseInt(this.getAttribute("end"),10);let n=this.shadowRoot.querySelector(".content"),a="",r=this.getAttribute("content");"string"==typeof r&&(a=r.replace(/\n/g,"¶"));let s=document.createElement("span"),i=document.createTextNode(a.substr(0,e)),d=document.createTextNode(a.substr(t)),o=document.createElement("span");if(e===t){o.classList.add("caret-wrapper");let e=document.createElement("span");e.classList.add("caret"),e.textContent="​",o.appendChild(e)}else{let n=document.createTextNode(a.substr(e,t-e));o.classList.add("highlight"),o.appendChild(n)}s.appendChild(i),s.appendChild(o),s.appendChild(d),n.children[0]&&n.removeChild(n.children[0]),n.appendChild(s)}attributeChangedCallback(e){switch(e){case"start":case"end":case"content":window.requestIdleCallback(()=>{this.updateContent()})}}}n.template="\n    <pre class='content'></pre>\n  ",n.style="\n    :host {\n      position: relative;\n    }\n\n    .content {\n      white-space: pre-wrap;\n    }\n\n    .caret-wrapper {\n      display: inline;\n      position: relative;\n      width: 0;\n    }\n\n    .caret {\n      background-color: rgb(96, 200, 240);\n      display: inline-block;\n      width: 2px;\n      border: 0;\n      padding: 0;\n      position: absolute;\n      left: -1px;\n      z-index: -1;\n    }\n\n    .highlight {\n      background-color: rgb(96, 200, 240);\n    }\n  ",n.observedAttributes=["start","end","content"],exports.default=n,window.customElements.get("character-counter")||window.customElements.define("character-counter",n);
},{"../../src/mixins/component":61}],70:[function(require,module,exports) {
"use strict";var n=this&&this.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(exports,"__esModule",{value:!0});const t=n(require("../mixins/component"));require("./annotations-inspector"),require("./character-counter");class e extends t.default{updatePosition({start:n,end:t}){this.shadowRoot.querySelector(".start").textContent=n,this.shadowRoot.querySelector(".end").textContent=t,n===t?this.shadowRoot.querySelector(".position").classList.add("is-caret"):this.shadowRoot.querySelector(".position").classList.remove("is-caret")}setDocument(n){this.document=n,this.shadowRoot.querySelector("annotations-inspector").setDocument(n),this.document.addEventListener("change",()=>{this.deferred&&clearTimeout(this.deferred),this.deferred=setTimeout(()=>{this.shadowRoot.querySelector("character-counter").setAttribute("content",this.document.content)},500)})}setSelection(n){n.addEventListener("change",n=>{this.selDeferred&&clearTimeout(this.selDeferred),this.selDeferred=setTimeout(t=>{let e=this.shadowRoot.querySelector("character-counter");e.setAttribute("start",n.detail.start),e.setAttribute("end",n.detail.end),this.updatePosition(n.detail)},500)})}}e.template='\n    <div class="heading"><div>AtJSON</div></div>\n    <section class="content">\n      <div class="heading"><div>Content</div></div>\n      <div class=\'position\'>\n        <span class=\'start\'></span>\n        <span class=\'end\'></span>\n      </div>\n      <div class="cc-container">\n        <character-counter start="0" end="0" length="0"></character-counter>\n      </div>\n    </section>\n\n    <section class="annotations">\n      <div class="heading"><div>Annotations</div></div>\n      <annotations-inspector class="annotations"></annotations-inspector>\n    </section>',e.style="\n    .heading {\n      font-size: 12px;\n      line-height: 15px;\n      height: 26px;\n      font-family: helvetica;\n      background-color: #f3f3f3;\n      color: #333;\n      padding: 0;\n      margin: 0;\n      font-weight: normal;\n      font-family: 'Segoe UI', Tahoma, sans-serif;\n      border-bottom: 1px solid #ccc;\n      display: flex;\n      flex-direction: row;\n    }\n\n    .heading > div {\n      padding: 4px 1em;\n      border-bottom: 2px solid #03a9f4;\n    }\n\n    .content {\n      margin-top: 1em;\n    }\n\n    section > .heading {\n      border-top: 1px solid #ccc;\n      background-color: #f6f6f6;\n    }\n\n    section > .heading > div {\n      border-bottom: none;\n    }\n\n    .content {\n      font-family: Consolas, Lucida Console, Courier New, monospace;\n      position: relative;\n      box-sizing: border;\n    }\n\n    .content .open, .content .close {\n      color: #333;\n      font-weight: bold\n    }\n\n    .cc-container {\n      max-width: 100%;\n      overflow-x: auto;\n      margin: 0 6px 5px 6px;\n    }\n\n    .position {\n      position: absolute;\n      top: 1ex;\n      right: 1ex;\n    }\n\n    .position.is-caret .end {\n      display: none;\n    }\n  ",exports.default=e,window.customElements.get("inspector-gadget")||window.customElements.define("inspector-gadget",e);
},{"../mixins/component":61,"./annotations-inspector":73,"./character-counter":74}],63:[function(require,module,exports) {
"use strict";var e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});const n=e(require("@atjson/renderer-webcomponent")),t=e(require("./mixins/component"));class l extends t.default{render(e){this.deferred||(this.deferred=(()=>{let t=e.detail.document,l=this.shadowRoot.querySelector(".wrapper"),d=new n.default(t).render(),a=this.renderChildren(d.childNodes);l.innerHTML="",l.appendChild(a),delete this.deferred}),window.requestIdleCallback(this.deferred))}handleClick(e){e.path[0].classList.contains("arrow")&&e.path[1].classList.toggle("collapsed")}addComponent(e){n.default.prototype[e.annotationName]=e.elementRenderer}renderChildren(e){let n=document.createElement("ol");for(let t of e){let e=document.createElement("li");if(3===t.nodeType){let l=document.createTextNode('"'+t.textContent.replace("\n","\\n")+'"');e.appendChild(l),n.appendChild(e);continue}let l=this.genTag(t),d=this.genTag(t,!0);if(1===t.childNodes.length&&3===t.childNodes[0].nodeType){let n=document.createTextNode(t.childNodes[0].textContent.replace("\n","\\n"));e.appendChild(l),e.appendChild(n),e.appendChild(d)}else t.childNodes.length>0&&this.renderArrow(e),e.appendChild(l),this.renderEllip(e),e.appendChild(this.renderChildren(t.childNodes)),e.appendChild(d);n.appendChild(e)}return n}genAttrs(e){let n=document.createElement("span");n.classList.add("html-attributes");for(let t of e.attributes){if("data-annotation-id"===t.name)continue;let e=document.createElement("span");e.classList.add("html-attribute");let l=document.createElement("span");l.classList.add("html-attribute-name"),l.textContent=t.name;let d=document.createElement("span");d.classList.add("html-attribute-value"),d.textContent=t.value,e.appendChild(l),e.appendChild(document.createTextNode('="')),e.appendChild(d),e.appendChild(document.createTextNode('"')),n.appendChild(e)}return n}genTag(e,n=!1){let t=document.createElement("span"),l="<";n&&(l+="/");let d=document.createTextNode(l),a=document.createTextNode(">");t.classList.add("html-tag"),n&&t.classList.add("closing");let i=document.createElement("span");return i.classList.add("html-tag-name"),i.textContent=e.tagName.toLowerCase(),t.appendChild(d),t.appendChild(i),n||t.appendChild(this.genAttrs(e)),t.appendChild(a),t}renderArrow(e){e.classList.add("collapsed"),e.classList.add("collapsible");let n=document.createElement("span");n.classList.add("arrow"),e.appendChild(n)}renderEllip(e){let n=document.createElement("span");n.textContent="…",n.classList.add("ellip"),e.appendChild(n)}}l.template='<div class="wrapper"></div>',l.events={click:"handleClick",change:"render"},l.style='\n    ol {\n      list-style-type: none;\n      font-family: Consolas, Lucida Console, Courier New, monospace;\n      border-left: 1px solid #ccc;\n      -webkit-padding-start: 0;\n      margin: 0 0 0 6px;\n    }\n\n    .wrapper > ol {\n      border-left: none;\n      padding-left: 0;\n    }\n\n    li {\n      padding-left: 18px;\n    }\n\n    li.collapsible {\n      padding-left: 0;\n    }\n\n    li.collapsible > ol {\n      padding-left: 8px;\n    }\n\n    li > .arrow::before {\n      content: "⯆";\n    }\n\n    li.collapsed > .arrow::before {\n      content: "⯈";\n    }\n\n    li .arrow {\n      color: #727272;\n      padding-right: 4px;\n    }\n\n    li.collapsed ol {\n      display: none;\n    }\n\n    li > .ellip {\n      display: none;\n    }\n\n    li.collapsed > .ellip {\n      display: inline;\n    }\n\n    .html-tag {\n      color: rgb(168, 148, 166);\n    }\n\n    li.collapsible > .html-tag.closing {\n      padding-left: 11px;\n      margin-left: 6px;\n      border-left: 1px solid #ccc;\n    }\n\n    li.collapsed > .html-tag.closing {\n      padding-left: 0;\n      margin-left: 0;\n      border-left: none;\n    }\n\n    .html-tag-name {\n      color: rgb(136, 18, 128);\n    }\n\n    .html-attribute-name {\n      padding-left: 1ex;\n      color: rgb(153, 69, 0);\n    }\n\n    .html-attribute-value {\n      color: rgb(26, 26, 166);\n    }\n  ',exports.default=l,window.customElements.get("html-tree-inspector")||window.customElements.define("html-tree-inspector",l);
},{"@atjson/renderer-webcomponent":51,"./mixins/component":61}],20:[function(require,module,exports) {
"use strict";var e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});const t=e(require("@atjson/document")),n=e(require("@atjson/renderer-commonmark"));require("./document-inspector"),require("./html-tree-inspector");const o=e(require("./mixins/component"));class i extends o.default{renderAll(e){let n;e&&(this._document=e.detail.document),this._document instanceof t.default&&(n=this._document,this._pendingCallback||(this._pendingCallback=(()=>{this.updateHtmlTreeInspector(n),this.renderMarkdown(n),this.renderInspector(n),delete this._pendingCallback}),window.requestIdleCallback(this._pendingCallback)))}renderMarkdown(e){if(this.activeTab("commonmark-tab")){let t=this.shadowRoot.querySelector(".markdown"),o=(new n.default).render(e);t&&(t.textContent=o)}}renderInspector(e){let t=this.shadowRoot.querySelector("inspector-gadget"),n=this.querySelector("offset-editor");t&&(t.setDocument(e),t.setSelection(n.getSelection()))}updateHtmlTreeInspector(e){this.activeTab("html-tab")&&this.shadowRoot.querySelector("html-tree-inspector").dispatchEvent(new CustomEvent("change",{detail:{document:e}}))}activeTab(e){let t=this.shadowRoot.querySelector(".tabs > .active");return!!t&&t.classList.contains(e)}}i.template='<h1><offset-logo></offset-logo></h1><div class="demo"><section class="editor"><header class="tabs"><div class="editor-tab active" data-target="editor-container">Editor</div><div class="html-tab" data-target="html-container">HTML</div><div class="commonmark-tab" data-target="commonmark-container">Commonmark</div></header><section class="editor-container active"><slot></slot></section><section class="html-container"><html-tree-inspector></html-tree-inspector></section><section class="commonmark-container"><div class="markdown"></div></section></section><section class="inspector"><section class="inspector-gadget"><inspector-gadget></inspector-gadget></section></section></div>',i.events={change:"renderAll","click .tabs"(e){let t=e.path[0].getAttribute("data-target"),n=this.shadowRoot.querySelector(".editor > .active");n&&n.classList.remove("active"),this.shadowRoot.querySelector(".editor > ."+t).classList.add("active"),this.shadowRoot.querySelector(".editor > .tabs > .active").classList.remove("active"),e.path[0].classList.add("active"),this.renderAll()},addComponent(e){this.shadowRoot.querySelector("html-tree-inspector").addComponent(e.detail.component)}},i.style="\n    :host {\n      max-height: 100vh;\n      max-width: 100vw;\n      margin: 0;\n      padding: 0;\n      display: flex;\n      flex-direction: column;\n    }\n\n    :host > h1 {\n      padding: 1ex;\n      margin: 0;\n      border-bottom: 1px solid #bbb;\n      background-color: #f3f3f3\n    }\n\n    .demo {\n      display: flex;\n      flex-direction: row;\n      margin: 0;\n      padding: 0;\n      height: 100vh;\n      width: 100vw;\n      overflow: hidden;\n    }\n\n    .demo > section {\n      position: relative;\n      flex-grow: 1;\n      max-height: 100%;\n      width: 50%;\n    }\n\n    .editor {\n      padding-right: 1px;\n      padding-bottom: 2em;\n      border-right: 1px solid #ccc;\n    }\n\n    .tabs {\n      display: flex;\n      flex-direction: row;\n      justify-content: flex-start;\n      background-color: #f3f3f3;\n      color: #333;\n      font-family: 'Segoe UI', Tahoma, sans-serif;\n      height: 26px;\n      line-height: 15px;\n      font-size: 12px;\n      border-bottom: 1px solid #ccc;\n      position: sticky;\n      top: 0;\n    }\n\n    .tabs > div {\n      padding: 4px 1em;\n      border-bottom: 1px solid #ccc;\n    }\n\n    .tabs > div:hover {\n      background-color: #eaeaea;\n      cursor: pointer;\n    }\n\n    .tabs > .active {\n      border-bottom: 2px solid #03a9f4;\n    }\n\n    .editor > section {\n      display: none;\n      overflow-y: auto;\n      position: relative;\n      max-height: calc(100% - 24px);\n      box-sizing: border-box;\n      padding: 1em;\n    }\n\n    .editor > section.active {\n      display: inherit;\n    }\n\n    .markdown {\n      white-space: pre-wrap;\n      font-family: Consolas, Lucida Console, Courier New, monospace;\n    }\n  ",exports.default=i,window.customElements.get("offset-editor-demo")||window.customElements.define("offset-editor-demo",i);
},{"@atjson/document":13,"@atjson/renderer-commonmark":68,"./document-inspector":70,"./html-tree-inspector":63,"./mixins/component":61}],11:[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});class e{static get selectionButton(){let e,t,n=document.createElement("button");return n.setAttribute("data-type",this.annotationName),n.innerHTML=this.annotationName,n.addEventListener("selectionchange",n=>{e=n.detail.start,t=n.detail.end,console.log("set start and end to",{start:e,end:t})}),n.addEventListener("click",a=>{n.dispatchEvent(new CustomEvent("addAnnotation",{bubbles:!0,composed:!0,detail:{type:"superscript",start:e,end:t}}))}),n}}e.annotationName="superscript",e.elementRenderer=(e=>document.createElement("sup")),exports.default=e;
},{}],5:[function(require,module,exports) {
"use strict";var e=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0});const t=e(require("@atjson/document"));require("@atjson/editor");const n=e(require("@atjson/offset-core-components"));require("../src");const o=e(require("./superscript"));module.hot&&module.hot.dispose(()=>{window.location.reload()}),document.addEventListener("DOMContentLoaded",()=>{let e=document.querySelector("offset-editor");for(let t of n.default)e.addContentFeature(t);e.addContentFeature(o.default);let a=new URL(location.toString()).searchParams.get("document");if(a)e.setDocument(new t.default(JSON.parse(a)));else{let n=new t.default({content:"Heading 1\nSome text that is both bold and italic plus something after.",annotations:[{type:"bold",display:"inline",start:33,end:41},{type:"link",display:"inline",start:30,end:34,attributes:{url:"https://google.com"}},{type:"italic",display:"inline",start:38,end:48},{type:"underline",display:"inline",start:38,end:48},{type:"heading",display:"block",start:0,end:10,attributes:{level:"1"}},{type:"paragraph",display:"block",start:10,end:71},{type:"superscript",display:"inline",start:41,end:48}]});e.setDocument(n)}});
},{"@atjson/document":13,"@atjson/editor":14,"@atjson/offset-core-components":15,"../src":20,"./superscript":11}]},{},[5], null)
//# sourceMappingURL=/app.3cd536b5.map