@markupai/sidebar-adapter 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.umd.cjs CHANGED
@@ -1,4 +1,4 @@
1
- (function(i,g){typeof exports=="object"&&typeof module<"u"?g(exports):typeof define=="function"&&define.amd?define(["exports"],g):(i=typeof globalThis<"u"?globalThis:i||self,g(i.main={}))})(this,function(i){Object.defineProperty(i,Symbol.toStringTag,{value:"Module"});var g=(function(e){return e.TEXT_PLAIN="text/plain",e.TEXT_MARKDOWN="text/markdown",e.TEXT_HTML="text/html",e.APPLICATION_DITA_XML="application/dita+xml",e})({}),te=["text/plain","text/markdown","text/html","application/dita+xml"],ne={integrationName:"unknown",integrationVersion:"unknown",integrationId:"markupai-sidebar-app",hideBanner:!1,supportCheckSelection:!0,multiAgent:!1,multiDocument:!1},re=e=>typeof e!="object"||e===null?!1:Array.isArray(e.fields),ie=e=>{if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.id!="string"||t.id.length===0||typeof t.label!="string"?!1:t.type==="boolean"?typeof t.default=="boolean":t.type==="enum"?typeof t.default!="string"||!Array.isArray(t.options)||t.options.length===0?!1:t.options.every(n=>{if(typeof n!="object"||n===null)return!1;const r=n;return typeof r.value=="string"&&typeof r.label=="string"}):!1},R="2.3.0",h=class Q extends Error{name="TextLookupError";constructor(t){super(t),Object.setPrototypeOf(this,Q.prototype)}},v=class ee extends h{name="ReplaceBatchError";applied;failed;constructor(t,n){super(t),this.applied=n.applied.map(r=>({start:r.start,end:r.end})),this.failed=n.failed.map(r=>T(r,r.message)),Object.setPrototypeOf(this,ee.prototype)}};function ae(e){return e instanceof v}function T(e,t){const n={start:e.start,end:e.end};return typeof t=="string"&&t.trim()!==""&&(n.message=t),n}function O(e){return Array.isArray(e)?e.flatMap(t=>{if(t===null||typeof t!="object")return[];const{start:n,end:r,message:a}=t;return typeof n!="number"||typeof r!="number"?[]:[{range:{start:n,end:r},message:a}]}):[]}function oe(e){return e instanceof h}var C={TextLookupError:e=>new h(e),ReplaceBatchError:(e,t)=>new v(e,{applied:O(t.applied).map(n=>n.range),failed:O(t.failed).map(n=>T(n.range,n.message))})};function _(e){const t=e.message??"",n=e.name,r=typeof n=="string"&&n in C?C[n]:void 0;return r?r(t,e):Object.assign(new Error(t),n?{name:n}:{})}var D=":",L=/^[a-z][a-z0-9-]*$/;function se(e){const t=e.indexOf(D);return t<=0||t===e.length-1?!1:L.test(e.slice(0,t))}function le(e,t){const n=e.trim().toLowerCase(),r=t.trim();if(!L.test(n))throw new Error(`Invalid document reference prefix ${JSON.stringify(e)}: expected a lowercase name like "word".`);if(r.length===0)throw new Error("Invalid document reference: the document id is empty.");const a=`${n}${D}`;return r.startsWith(a)?r:`${a}${r}`}var M=class extends Promise{static get[Symbol.species](){return Promise}resolve;reject;constructor(e=()=>{}){let t,n;super((r,a)=>{t=r,n=a,e(r,a)}),this.resolve=t,this.reject=n}},B={timeout:1e4};function ce(e){const t=typeof e=="object"&&e!==null?Object.fromEntries(Object.getOwnPropertyNames(e).map(s=>[s,e[s]])):{},n=e instanceof Error?e.message:String(e),r=typeof t.message=="string"&&t.message!==""?t.message:n,a=e instanceof Error?e.name:void 0,o=typeof t.name=="string"?t.name:a;return JSON.stringify({...t,message:r,...o!==void 0&&{name:o}})}var b=class{promisesByID={};receiversByName={};currentID=0;config;postMessage;constructor(e,t){this.postMessage=e,this.config={...B,...t}}configure(e){this.config={...this.config,...e}}call(e,...t){return this.callWithOptions(e,{},...t)}callWithOptions(e,t,...n){const r=this.currentID++,a=new M,o=t.timeout??this.config.timeout,s=setTimeout(()=>{if(r in this.promisesByID){const c=new Error(`IPC call timeout: "${e}" did not respond within ${String(o)}ms`);a.reject(c),Reflect.deleteProperty(this.promisesByID,r)}},o);this.promisesByID[r]={promise:a,timeoutId:s};const l={type:"call",id:r,name:e,data:n};return this.postMessage(l),a}receive(e,t){this.receiversByName[e]=t}ignore(e){delete this.receiversByName[e]}async handleMessage(e){switch(e.type){case"call":await this.handleCall(e);break;case"response":this.handleResponse(e);break;case"error":this.handleError(e);break;default:}}async handleCall(e){const{id:t,name:n,data:r}=e;if(!(n in this.receiversByName)){const o=new Error(`No receiver registered for: ${n}`),s=JSON.stringify({message:o.message,name:o.name});this.postMessage({type:"error",id:t,name:n,errorJSON:s});return}const a=this.receiversByName[n];try{if(!Array.isArray(r))throw new TypeError(`IPC: Expected array of arguments but got ${typeof r}`);const o=await a(...r),s={type:"response",id:t,name:n,data:o};this.postMessage(s)}catch(o){const s={type:"error",id:t,name:n,errorJSON:ce(o)};this.postMessage(s)}}handleResponse(e){const{id:t}=e;if(t in this.promisesByID){const{promise:n,timeoutId:r}=this.promisesByID[t];clearTimeout(r),n.resolve(e.data),Reflect.deleteProperty(this.promisesByID,t)}}handleError(e){const{id:t,errorJSON:n}=e;if(t in this.promisesByID){const{promise:r,timeoutId:a}=this.promisesByID[t];clearTimeout(a);try{const o=JSON.parse(n),s=_(o);r.reject(s)}catch{r.reject(new Error("Failed to parse error from IPC"))}Reflect.deleteProperty(this.promisesByID,t)}}destroy(){for(const{promise:e,timeoutId:t}of Object.values(this.promisesByID))clearTimeout(t),e.reject(new Error("IPC destroyed"));this.promisesByID={},this.receiversByName={}}},Ne=64,de=new Set(["auto","prompt"]),S=(e,t)=>{const n=e[t];if(!(typeof n!="string"||n.length===0))return n.slice(0,64)};function ge(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;const t=e,n=S(t,"version"),r=S(t,"commitHash");if(n===void 0||r===void 0)return null;const a={version:n,commitHash:r};typeof t.swControlled=="boolean"&&(a.swControlled=t.swControlled),de.has(t.pwaUpdateMode)&&(a.pwaUpdateMode=t.pwaUpdateMode);const o=S(t,"adapterVersion");return o!==void 0&&(a.adapterVersion=o),a}function ue(e){return typeof e!="string"||e.length===0?null:e.slice(0,64)}function He(e,t){if(!e)return`getInitConfig from sidebar build unknown (no valid build report — sidebar predates build reporting; host adapter ${t})`;const n=[e.commitHash];return e.swControlled!==void 0&&n.push(e.swControlled?"sw-controlled":"network"),e.pwaUpdateMode&&n.push(`${e.pwaUpdateMode} update mode`),e.adapterVersion&&n.push(`sidebar adapter ${e.adapterVersion}`),n.push(`host adapter ${t}`),`getInitConfig from sidebar v${e.version} (${n.join(", ")})`}var k=class{ipc;sidebar;targetOrigin;latestHostAdapterVersion=null;constructor(e,t,n="*"){this.sidebar=e||{},this.targetOrigin=n,this.ipc=new b(r=>{window.parent.postMessage(r,this.targetOrigin)},t),window.addEventListener("message",this.handleMessage),this.registerReceivers()}handleMessage=e=>{const t=globalThis.window.location.origin,n=this.targetOrigin;e.origin!==t&&(n!=="*"&&e.origin!==n||e.data&&typeof e.data=="object"&&this.ipc.handleMessage(e.data))};registerReceivers(){if(this.sidebar.onPluginStatusChange){const e=this.sidebar.onPluginStatusChange;this.ipc.receive("onPluginStatusChange",async(t,n)=>{await e(t,n)})}if(this.sidebar.activateAgenticIssue){const e=this.sidebar.activateAgenticIssue;this.ipc.receive("activateAgenticIssue",async(t,n)=>{await e(t,typeof n=="string"?n:null)})}if(this.sidebar.invalidateAgenticIssue){const e=this.sidebar.invalidateAgenticIssue;this.ipc.receive("invalidateAgenticIssue",async t=>{await e(t)})}if(this.sidebar.markAgenticIssueResolved){const e=this.sidebar.markAgenticIssueResolved;this.ipc.receive("markAgenticIssueResolved",async t=>{await e(t)})}if(this.sidebar.restoreAgenticIssue){const e=this.sidebar.restoreAgenticIssue;this.ipc.receive("restoreAgenticIssue",async t=>{await e(t)})}if(this.sidebar.applyIntegrationSettings){const e=this.sidebar.applyIntegrationSettings;this.ipc.receive("applyIntegrationSettings",async t=>{await e(t)})}if(this.sidebar.getIntegrationSettings){const e=this.sidebar.getIntegrationSettings;this.ipc.receive("getIntegrationSettings",async()=>await e())}if(this.sidebar.onActiveDocumentChanged){const e=this.sidebar.onActiveDocumentChanged;this.ipc.receive("onActiveDocumentChanged",async t=>{await e(t)})}}async getInitConfig(e){const{hostAdapterVersion:t,...n}=e?await this.ipc.call("getInitConfig",{...e,adapterVersion:e.adapterVersion??"2.3.0"}):await this.ipc.call("getInitConfig");return this.latestHostAdapterVersion=ue(t),n}getHostAdapterVersion(){return this.latestHostAdapterVersion}async getContent(e){return this.ipc.callWithOptions("getContent",e??{})}async getSelectedContent(e){return this.ipc.callWithOptions("getSelectedContent",e??{})}async replaceContent(e,t,n=null){await this.ipc.call("replaceContent",e,t,n)}async selectContent(e,t=null){await this.ipc.call("selectContent",e,t)}async replaceMultipleContents(e){await this.ipc.call("replaceMultipleContents",e)}async onAgenticAgentResults(e,t,n=null){await this.ipc.call("onAgenticAgentResults",e,t,n)}async onAgenticStreamComplete(e=null){await this.ipc.call("onAgenticStreamComplete",e)}async onAgenticIssueStatusChanged(e,t,n){await this.ipc.call("onAgenticIssueStatusChanged",e,t,n)}async onAgenticIssuesCleared(e=null){await this.ipc.call("onAgenticIssuesCleared",e)}async openAuthUrl(e){await this.ipc.call("openAuthUrl",e)}async copyToClipboard(e){await this.ipc.call("copyToClipboard",e)}async onIntegrationSettingsChange(e,t){await this.ipc.call("onIntegrationSettingsChange",e,t)}configure(e){this.ipc.configure(e)}setTargetOrigin(e){if(!e||typeof e!="string")throw new Error("Invalid targetOrigin: must be a non-empty string");try{const t=new URL(e);if(!["http:","https:"].includes(t.protocol)||!t.host)throw new Error("Invalid targetOrigin: protocol must be http or https and must have a host")}catch{throw new Error("Invalid targetOrigin: must be a valid origin (e.g., https://example.com)")}this.targetOrigin=e}getTargetOrigin(){return this.targetOrigin}destroy(){window.removeEventListener("message",this.handleMessage),this.ipc.destroy()}},pe=class{ipcAdapter;constructor(e,t,n){this.ipcAdapter=new k(e,t,n)}destroy(){this.ipcAdapter.destroy()}async getInitConfig(e){return await this.ipcAdapter.getInitConfig(e)}getHostAdapterVersion(){return this.ipcAdapter.getHostAdapterVersion()}async getContent(e){return await this.ipcAdapter.getContent(e)}async getSelectedContent(e){return await this.ipcAdapter.getSelectedContent(e)}async replaceContent(e,t,n=null){await this.ipcAdapter.replaceContent(e,t,n)}async selectContent(e,t=null){await this.ipcAdapter.selectContent(e,t)}async replaceMultipleContents(e){await this.ipcAdapter.replaceMultipleContents(e)}onAgenticAgentResults(e,t,n=null){return this.ipcAdapter.onAgenticAgentResults(e,t,n)}onAgenticStreamComplete(e=null){return this.ipcAdapter.onAgenticStreamComplete(e)}onAgenticIssueStatusChanged(e,t,n){return this.ipcAdapter.onAgenticIssueStatusChanged(e,t,n)}onAgenticIssuesCleared(e=null){return this.ipcAdapter.onAgenticIssuesCleared(e)}openAuthUrl(e){return this.ipcAdapter.openAuthUrl(e)}copyToClipboard(e){return this.ipcAdapter.copyToClipboard(e)}onIntegrationSettingsChange(e,t){return this.ipcAdapter.onIntegrationSettingsChange(e,t)}configure(e){this.ipcAdapter.configure(e)}setTargetOrigin(e){this.ipcAdapter.setTargetOrigin(e)}getTargetOrigin(){return this.ipcAdapter.getTargetOrigin()}},N=class{ipc;plugin;iframe;window;targetOrigin;latestSidebarBuildInfo=null;constructor(e,t,n,r,a="*"){this.plugin=e,this.iframe=t,this.window=n??window,this.targetOrigin=a,this.ipc=new b(o=>{this.iframe.contentWindow?.postMessage(o,this.targetOrigin)},r),this.window.addEventListener("message",this.handleMessage,!1),this.registerReceivers()}handleMessage=e=>{const t=this.window.location.origin,n=this.targetOrigin;e.origin!==t&&(n!=="*"&&e.origin!==n||e.data&&typeof e.data=="object"&&this.ipc.handleMessage(e.data))};registerReceivers(){if(this.ipc.receive("getInitConfig",async e=>{const t=ge(e);return this.latestSidebarBuildInfo=t,{...await this.plugin.getInitConfig(t??void 0),hostAdapterVersion:R}}),this.ipc.receive("getContent",async()=>await this.plugin.getContent()),this.ipc.receive("getSelectedContent",async()=>await this.plugin.getSelectedContent()),this.ipc.receive("replaceContent",async(e,t,n)=>{await this.plugin.replaceContent(e,t,typeof n=="string"?n:null)}),this.ipc.receive("selectContent",async(e,t)=>{await this.plugin.selectContent(e,typeof t=="string"?t:null)}),this.ipc.receive("replaceMultipleContents",async e=>{await this.plugin.replaceMultipleContents(e)}),this.ipc.receive("onAgenticAgentResults",async(e,t,n)=>{if(!Array.isArray(t))return;const r=this.plugin.onAgenticAgentResults;r&&await r(e,t,typeof n=="string"?n:null)}),this.ipc.receive("onAgenticStreamComplete",async e=>{const t=this.plugin.onAgenticStreamComplete;t&&await t(typeof e=="string"?e:null)}),this.ipc.receive("onAgenticIssueStatusChanged",async(e,t,n)=>{const r=this.plugin.onAgenticIssueStatusChanged;if(r&&!(t!=="active"&&t!=="resolved"&&t!=="dismissed"||n!=="user"&&n!=="host"))try{await r(e,t,n)}catch{}}),this.ipc.receive("onAgenticIssuesCleared",async e=>{const t=this.plugin.onAgenticIssuesCleared;if(t)try{await t(typeof e=="string"?e:null)}catch{}}),this.plugin.openAuthUrl){const e=this.plugin.openAuthUrl;this.ipc.receive("openAuthUrl",async t=>{await e(t)})}if(this.plugin.copyToClipboard){const e=this.plugin.copyToClipboard;this.ipc.receive("copyToClipboard",async t=>{await e(t)})}if(this.plugin.onIntegrationSettingsChange){const e=this.plugin.onIntegrationSettingsChange;this.ipc.receive("onIntegrationSettingsChange",async(t,n)=>{await e(t,n)})}}async activateAgenticIssue(e,t=null){await this.ipc.call("activateAgenticIssue",e,t)}async invalidateAgenticIssue(e){await this.ipc.call("invalidateAgenticIssue",e)}async markAgenticIssueResolved(e){await this.ipc.call("markAgenticIssueResolved",e)}async restoreAgenticIssue(e){await this.ipc.call("restoreAgenticIssue",e)}async notifyPluginStatus(e,t){await this.ipc.call("onPluginStatusChange",e,t)}async applyIntegrationSettings(e){await this.ipc.call("applyIntegrationSettings",e)}async getIntegrationSettings(){return await this.ipc.call("getIntegrationSettings")}async notifyActiveDocumentChanged(e){await this.ipc.call("onActiveDocumentChanged",e)}getSidebarBuildInfo(){return this.latestSidebarBuildInfo}configure(e){this.ipc.configure(e)}destroy(){this.window.removeEventListener("message",this.handleMessage),this.ipc.destroy()}},H=class{ipcAdapter;constructor(e,t,n){this.ipcAdapter=new N(e,t,n?.win,n?.config,n?.targetOrigin)}destroy(){this.ipcAdapter.destroy()}async notifyPluginStatus(e,t){await this.ipcAdapter.notifyPluginStatus(e,t)}async activateAgenticIssue(e,t=null){await this.ipcAdapter.activateAgenticIssue(e,t)}async invalidateAgenticIssue(e){await this.ipcAdapter.invalidateAgenticIssue(e)}async markAgenticIssueResolved(e){await this.ipcAdapter.markAgenticIssueResolved(e)}async restoreAgenticIssue(e){await this.ipcAdapter.restoreAgenticIssue(e)}async applyIntegrationSettings(e){await this.ipcAdapter.applyIntegrationSettings(e)}async getIntegrationSettings(){return await this.ipcAdapter.getIntegrationSettings()}async notifyActiveDocumentChanged(e){await this.ipcAdapter.notifyActiveDocumentChanged(e)}getSidebarBuildInfo(){return this.ipcAdapter.getSidebarBuildInfo()}configure(e){this.ipcAdapter.configure(e)}},he=`
1
+ (function(r,g){typeof exports=="object"&&typeof module<"u"?g(exports):typeof define=="function"&&define.amd?define(["exports"],g):(r=typeof globalThis<"u"?globalThis:r||self,g(r.main={}))})(this,function(r){Object.defineProperty(r,Symbol.toStringTag,{value:"Module"});var g=(function(e){return e.TEXT_PLAIN="text/plain",e.TEXT_MARKDOWN="text/markdown",e.TEXT_HTML="text/html",e.APPLICATION_DITA_XML="application/dita+xml",e})({}),te=["text/plain","text/markdown","text/html","application/dita+xml"],ne={integrationName:"unknown",integrationVersion:"unknown",integrationId:"markupai-sidebar-app",hideBanner:!1,supportCheckSelection:!0,supportComments:!1,multiAgent:!1,multiDocument:!1},ie=e=>typeof e!="object"||e===null?!1:Array.isArray(e.fields),re=e=>{if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.id!="string"||t.id.length===0||typeof t.label!="string"?!1:t.type==="boolean"?typeof t.default=="boolean":t.type==="enum"?typeof t.default!="string"||!Array.isArray(t.options)||t.options.length===0?!1:t.options.every(n=>{if(typeof n!="object"||n===null)return!1;const i=n;return typeof i.value=="string"&&typeof i.label=="string"}):!1},R="2.4.0",h=class Q extends Error{name="TextLookupError";constructor(t){super(t),Object.setPrototypeOf(this,Q.prototype)}},v=class ee extends h{name="ReplaceBatchError";applied;failed;constructor(t,n){super(t),this.applied=n.applied.map(i=>({start:i.start,end:i.end})),this.failed=n.failed.map(i=>T(i,i.message)),Object.setPrototypeOf(this,ee.prototype)}};function ae(e){return e instanceof v}function T(e,t){const n={start:e.start,end:e.end};return typeof t=="string"&&t.trim()!==""&&(n.message=t),n}function O(e){return Array.isArray(e)?e.flatMap(t=>{if(t===null||typeof t!="object")return[];const{start:n,end:i,message:a}=t;return typeof n!="number"||typeof i!="number"?[]:[{range:{start:n,end:i},message:a}]}):[]}function oe(e){return e instanceof h}var C={TextLookupError:e=>new h(e),ReplaceBatchError:(e,t)=>new v(e,{applied:O(t.applied).map(n=>n.range),failed:O(t.failed).map(n=>T(n.range,n.message))})};function _(e){const t=e.message??"",n=e.name,i=typeof n=="string"&&n in C?C[n]:void 0;return i?i(t,e):Object.assign(new Error(t),n?{name:n}:{})}var D=":",L=/^[a-z][a-z0-9-]*$/;function se(e){const t=e.indexOf(D);return t<=0||t===e.length-1?!1:L.test(e.slice(0,t))}function le(e,t){const n=e.trim().toLowerCase(),i=t.trim();if(!L.test(n))throw new Error(`Invalid document reference prefix ${JSON.stringify(e)}: expected a lowercase name like "word".`);if(i.length===0)throw new Error("Invalid document reference: the document id is empty.");const a=`${n}${D}`;return i.startsWith(a)?i:`${a}${i}`}var M=class extends Promise{static get[Symbol.species](){return Promise}resolve;reject;constructor(e=()=>{}){let t,n;super((i,a)=>{t=i,n=a,e(i,a)}),this.resolve=t,this.reject=n}},B={timeout:1e4};function ce(e){const t=typeof e=="object"&&e!==null?Object.fromEntries(Object.getOwnPropertyNames(e).map(s=>[s,e[s]])):{},n=e instanceof Error?e.message:String(e),i=typeof t.message=="string"&&t.message!==""?t.message:n,a=e instanceof Error?e.name:void 0,o=typeof t.name=="string"?t.name:a;return JSON.stringify({...t,message:i,...o!==void 0&&{name:o}})}var b=class{promisesByID={};receiversByName={};currentID=0;config;postMessage;constructor(e,t){this.postMessage=e,this.config={...B,...t}}configure(e){this.config={...this.config,...e}}call(e,...t){return this.callWithOptions(e,{},...t)}callWithOptions(e,t,...n){const i=this.currentID++,a=new M,o=t.timeout??this.config.timeout,s=setTimeout(()=>{if(i in this.promisesByID){const c=new Error(`IPC call timeout: "${e}" did not respond within ${String(o)}ms`);a.reject(c),Reflect.deleteProperty(this.promisesByID,i)}},o);this.promisesByID[i]={promise:a,timeoutId:s};const l={type:"call",id:i,name:e,data:n};return this.postMessage(l),a}receive(e,t){this.receiversByName[e]=t}ignore(e){delete this.receiversByName[e]}async handleMessage(e){switch(e.type){case"call":await this.handleCall(e);break;case"response":this.handleResponse(e);break;case"error":this.handleError(e);break;default:}}async handleCall(e){const{id:t,name:n,data:i}=e;if(!(n in this.receiversByName)){const o=new Error(`No receiver registered for: ${n}`),s=JSON.stringify({message:o.message,name:o.name});this.postMessage({type:"error",id:t,name:n,errorJSON:s});return}const a=this.receiversByName[n];try{if(!Array.isArray(i))throw new TypeError(`IPC: Expected array of arguments but got ${typeof i}`);const o=await a(...i),s={type:"response",id:t,name:n,data:o};this.postMessage(s)}catch(o){const s={type:"error",id:t,name:n,errorJSON:ce(o)};this.postMessage(s)}}handleResponse(e){const{id:t}=e;if(t in this.promisesByID){const{promise:n,timeoutId:i}=this.promisesByID[t];clearTimeout(i),n.resolve(e.data),Reflect.deleteProperty(this.promisesByID,t)}}handleError(e){const{id:t,errorJSON:n}=e;if(t in this.promisesByID){const{promise:i,timeoutId:a}=this.promisesByID[t];clearTimeout(a);try{const o=JSON.parse(n),s=_(o);i.reject(s)}catch{i.reject(new Error("Failed to parse error from IPC"))}Reflect.deleteProperty(this.promisesByID,t)}}destroy(){for(const{promise:e,timeoutId:t}of Object.values(this.promisesByID))clearTimeout(t),e.reject(new Error("IPC destroyed"));this.promisesByID={},this.receiversByName={}}},Ne=64,de=new Set(["auto","prompt"]),S=(e,t)=>{const n=e[t];if(!(typeof n!="string"||n.length===0))return n.slice(0,64)};function ge(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;const t=e,n=S(t,"version"),i=S(t,"commitHash");if(n===void 0||i===void 0)return null;const a={version:n,commitHash:i};typeof t.swControlled=="boolean"&&(a.swControlled=t.swControlled),de.has(t.pwaUpdateMode)&&(a.pwaUpdateMode=t.pwaUpdateMode);const o=S(t,"adapterVersion");return o!==void 0&&(a.adapterVersion=o),a}function ue(e){return typeof e!="string"||e.length===0?null:e.slice(0,64)}function He(e,t){if(!e)return`getInitConfig from sidebar build unknown (no valid build report — sidebar predates build reporting; host adapter ${t})`;const n=[e.commitHash];return e.swControlled!==void 0&&n.push(e.swControlled?"sw-controlled":"network"),e.pwaUpdateMode&&n.push(`${e.pwaUpdateMode} update mode`),e.adapterVersion&&n.push(`sidebar adapter ${e.adapterVersion}`),n.push(`host adapter ${t}`),`getInitConfig from sidebar v${e.version} (${n.join(", ")})`}var k=class{ipc;sidebar;targetOrigin;latestHostAdapterVersion=null;constructor(e,t,n="*"){this.sidebar=e||{},this.targetOrigin=n,this.ipc=new b(i=>{window.parent.postMessage(i,this.targetOrigin)},t),window.addEventListener("message",this.handleMessage),this.registerReceivers()}handleMessage=e=>{const t=globalThis.window.location.origin,n=this.targetOrigin;e.origin!==t&&(n!=="*"&&e.origin!==n||e.data&&typeof e.data=="object"&&this.ipc.handleMessage(e.data))};registerReceivers(){if(this.sidebar.onPluginStatusChange){const e=this.sidebar.onPluginStatusChange;this.ipc.receive("onPluginStatusChange",async(t,n)=>{await e(t,n)})}if(this.sidebar.activateAgenticIssue){const e=this.sidebar.activateAgenticIssue;this.ipc.receive("activateAgenticIssue",async(t,n)=>{await e(t,typeof n=="string"?n:null)})}if(this.sidebar.invalidateAgenticIssue){const e=this.sidebar.invalidateAgenticIssue;this.ipc.receive("invalidateAgenticIssue",async t=>{await e(t)})}if(this.sidebar.markAgenticIssueResolved){const e=this.sidebar.markAgenticIssueResolved;this.ipc.receive("markAgenticIssueResolved",async t=>{await e(t)})}if(this.sidebar.restoreAgenticIssue){const e=this.sidebar.restoreAgenticIssue;this.ipc.receive("restoreAgenticIssue",async t=>{await e(t)})}if(this.sidebar.applyIntegrationSettings){const e=this.sidebar.applyIntegrationSettings;this.ipc.receive("applyIntegrationSettings",async t=>{await e(t)})}if(this.sidebar.getIntegrationSettings){const e=this.sidebar.getIntegrationSettings;this.ipc.receive("getIntegrationSettings",async()=>await e())}if(this.sidebar.onActiveDocumentChanged){const e=this.sidebar.onActiveDocumentChanged;this.ipc.receive("onActiveDocumentChanged",async t=>{await e(t)})}}async getInitConfig(e){const{hostAdapterVersion:t,...n}=e?await this.ipc.call("getInitConfig",{...e,adapterVersion:e.adapterVersion??"2.4.0"}):await this.ipc.call("getInitConfig");return this.latestHostAdapterVersion=ue(t),n}getHostAdapterVersion(){return this.latestHostAdapterVersion}async getContent(e){return this.ipc.callWithOptions("getContent",e??{})}async getSelectedContent(e){return this.ipc.callWithOptions("getSelectedContent",e??{})}async replaceContent(e,t,n=null){await this.ipc.call("replaceContent",e,t,n)}async selectContent(e,t=null){await this.ipc.call("selectContent",e,t)}async replaceMultipleContents(e){await this.ipc.call("replaceMultipleContents",e)}async onAgenticAgentResults(e,t,n=null){await this.ipc.call("onAgenticAgentResults",e,t,n)}async onAgenticStreamComplete(e=null){await this.ipc.call("onAgenticStreamComplete",e)}async onAgenticIssueStatusChanged(e,t,n){await this.ipc.call("onAgenticIssueStatusChanged",e,t,n)}async onAgenticIssuesCleared(e=null){await this.ipc.call("onAgenticIssuesCleared",e)}async openAuthUrl(e){await this.ipc.call("openAuthUrl",e)}async copyToClipboard(e){await this.ipc.call("copyToClipboard",e)}async addComment(e,t=null){await this.ipc.call("addComment",e,t)}async onIntegrationSettingsChange(e,t){await this.ipc.call("onIntegrationSettingsChange",e,t)}configure(e){this.ipc.configure(e)}setTargetOrigin(e){if(!e||typeof e!="string")throw new Error("Invalid targetOrigin: must be a non-empty string");try{const t=new URL(e);if(!["http:","https:"].includes(t.protocol)||!t.host)throw new Error("Invalid targetOrigin: protocol must be http or https and must have a host")}catch{throw new Error("Invalid targetOrigin: must be a valid origin (e.g., https://example.com)")}this.targetOrigin=e}getTargetOrigin(){return this.targetOrigin}destroy(){window.removeEventListener("message",this.handleMessage),this.ipc.destroy()}},pe=class{ipcAdapter;constructor(e,t,n){this.ipcAdapter=new k(e,t,n)}destroy(){this.ipcAdapter.destroy()}async getInitConfig(e){return await this.ipcAdapter.getInitConfig(e)}getHostAdapterVersion(){return this.ipcAdapter.getHostAdapterVersion()}async getContent(e){return await this.ipcAdapter.getContent(e)}async getSelectedContent(e){return await this.ipcAdapter.getSelectedContent(e)}async replaceContent(e,t,n=null){await this.ipcAdapter.replaceContent(e,t,n)}async selectContent(e,t=null){await this.ipcAdapter.selectContent(e,t)}async replaceMultipleContents(e){await this.ipcAdapter.replaceMultipleContents(e)}onAgenticAgentResults(e,t,n=null){return this.ipcAdapter.onAgenticAgentResults(e,t,n)}onAgenticStreamComplete(e=null){return this.ipcAdapter.onAgenticStreamComplete(e)}onAgenticIssueStatusChanged(e,t,n){return this.ipcAdapter.onAgenticIssueStatusChanged(e,t,n)}onAgenticIssuesCleared(e=null){return this.ipcAdapter.onAgenticIssuesCleared(e)}openAuthUrl(e){return this.ipcAdapter.openAuthUrl(e)}copyToClipboard(e){return this.ipcAdapter.copyToClipboard(e)}addComment(e,t=null){return this.ipcAdapter.addComment(e,t)}onIntegrationSettingsChange(e,t){return this.ipcAdapter.onIntegrationSettingsChange(e,t)}configure(e){this.ipcAdapter.configure(e)}setTargetOrigin(e){this.ipcAdapter.setTargetOrigin(e)}getTargetOrigin(){return this.ipcAdapter.getTargetOrigin()}},N=class{ipc;plugin;iframe;window;targetOrigin;latestSidebarBuildInfo=null;constructor(e,t,n,i,a="*"){this.plugin=e,this.iframe=t,this.window=n??window,this.targetOrigin=a,this.ipc=new b(o=>{this.iframe.contentWindow?.postMessage(o,this.targetOrigin)},i),this.window.addEventListener("message",this.handleMessage,!1),this.registerReceivers()}handleMessage=e=>{const t=this.window.location.origin,n=this.targetOrigin;e.origin!==t&&(n!=="*"&&e.origin!==n||e.data&&typeof e.data=="object"&&this.ipc.handleMessage(e.data))};registerReceivers(){if(this.ipc.receive("getInitConfig",async e=>{const t=ge(e);return this.latestSidebarBuildInfo=t,{...await this.plugin.getInitConfig(t??void 0),hostAdapterVersion:R}}),this.ipc.receive("getContent",async()=>await this.plugin.getContent()),this.ipc.receive("getSelectedContent",async()=>await this.plugin.getSelectedContent()),this.ipc.receive("replaceContent",async(e,t,n)=>{await this.plugin.replaceContent(e,t,typeof n=="string"?n:null)}),this.ipc.receive("selectContent",async(e,t)=>{await this.plugin.selectContent(e,typeof t=="string"?t:null)}),this.ipc.receive("replaceMultipleContents",async e=>{await this.plugin.replaceMultipleContents(e)}),this.ipc.receive("onAgenticAgentResults",async(e,t,n)=>{if(!Array.isArray(t))return;const i=this.plugin.onAgenticAgentResults;i&&await i(e,t,typeof n=="string"?n:null)}),this.ipc.receive("onAgenticStreamComplete",async e=>{const t=this.plugin.onAgenticStreamComplete;t&&await t(typeof e=="string"?e:null)}),this.ipc.receive("onAgenticIssueStatusChanged",async(e,t,n)=>{const i=this.plugin.onAgenticIssueStatusChanged;if(i&&!(t!=="active"&&t!=="resolved"&&t!=="dismissed"||n!=="user"&&n!=="host"))try{await i(e,t,n)}catch{}}),this.ipc.receive("onAgenticIssuesCleared",async e=>{const t=this.plugin.onAgenticIssuesCleared;if(t)try{await t(typeof e=="string"?e:null)}catch{}}),this.plugin.openAuthUrl){const e=this.plugin.openAuthUrl;this.ipc.receive("openAuthUrl",async t=>{await e(t)})}if(this.plugin.copyToClipboard){const e=this.plugin.copyToClipboard;this.ipc.receive("copyToClipboard",async t=>{await e(t)})}if(this.plugin.addComment){const e=this.plugin.addComment;this.ipc.receive("addComment",async(t,n)=>{await e(t,typeof n=="string"?n:null)})}if(this.plugin.onIntegrationSettingsChange){const e=this.plugin.onIntegrationSettingsChange;this.ipc.receive("onIntegrationSettingsChange",async(t,n)=>{await e(t,n)})}}async activateAgenticIssue(e,t=null){await this.ipc.call("activateAgenticIssue",e,t)}async invalidateAgenticIssue(e){await this.ipc.call("invalidateAgenticIssue",e)}async markAgenticIssueResolved(e){await this.ipc.call("markAgenticIssueResolved",e)}async restoreAgenticIssue(e){await this.ipc.call("restoreAgenticIssue",e)}async notifyPluginStatus(e,t){await this.ipc.call("onPluginStatusChange",e,t)}async applyIntegrationSettings(e){await this.ipc.call("applyIntegrationSettings",e)}async getIntegrationSettings(){return await this.ipc.call("getIntegrationSettings")}async notifyActiveDocumentChanged(e){await this.ipc.call("onActiveDocumentChanged",e)}getSidebarBuildInfo(){return this.latestSidebarBuildInfo}configure(e){this.ipc.configure(e)}destroy(){this.window.removeEventListener("message",this.handleMessage),this.ipc.destroy()}},H=class{ipcAdapter;constructor(e,t,n){this.ipcAdapter=new N(e,t,n?.win,n?.config,n?.targetOrigin)}destroy(){this.ipcAdapter.destroy()}async notifyPluginStatus(e,t){await this.ipcAdapter.notifyPluginStatus(e,t)}async activateAgenticIssue(e,t=null){await this.ipcAdapter.activateAgenticIssue(e,t)}async invalidateAgenticIssue(e){await this.ipcAdapter.invalidateAgenticIssue(e)}async markAgenticIssueResolved(e){await this.ipcAdapter.markAgenticIssueResolved(e)}async restoreAgenticIssue(e){await this.ipcAdapter.restoreAgenticIssue(e)}async applyIntegrationSettings(e){await this.ipcAdapter.applyIntegrationSettings(e)}async getIntegrationSettings(){return await this.ipcAdapter.getIntegrationSettings()}async notifyActiveDocumentChanged(e){await this.ipcAdapter.notifyActiveDocumentChanged(e)}getSidebarBuildInfo(){return this.ipcAdapter.getSidebarBuildInfo()}configure(e){this.ipcAdapter.configure(e)}},he=`
2
2
  <div class="sidebar-load-overlay-card">
3
3
  <div class="sidebar-load-overlay-title">Sidebar failed to load</div>
4
4
  <div class="sidebar-load-overlay-description">Check your connection or try again.</div>
@@ -111,7 +111,7 @@
111
111
  box-shadow: 0 0 0 2px
112
112
  color-mix(in srgb, var(--accent, #ef4640) 60%, transparent);
113
113
  }
114
- `,Ie=e=>{const t=e??document;if(t.getElementById(U))return;const n=t.createElement("style");n.id=U,n.textContent=me,t.head.appendChild(n)},ye=8e3,Ae=12e3,F=(e,t,n={})=>{Ie(e.ownerDocument);const{sidebarUrl:r,targetOrigin:a,timeoutMs:o=ye,retryIntervalMs:s=Ae,messageListenWindow:l}=n,c=l??(typeof globalThis.window<"u"?globalThis.window:globalThis),f=()=>r??t.src,Be=()=>{if(a)return a;try{return new URL(f()).origin}catch{return"*"}},{overlay:P,button:z}=fe();e.appendChild(P);let m=!1,I,u;const p=d=>{P.style.display=d?"flex":"none"};p(!1);const y=()=>{I&&(globalThis.clearTimeout(I),I=void 0)},Y=()=>{y(),I=globalThis.setTimeout(()=>{m||p(!0)},o)},J=d=>{const A=d?.preserveOverlay??!0;m=!1,A||p(!1),t.src=f(),Y()},ke=()=>{u||s<=0||(u=globalThis.setInterval(()=>{m||J({preserveOverlay:!0})},s))},X=()=>{u&&(globalThis.clearInterval(u),u=void 0)},K=d=>{if(!t.contentWindow||d.source!==t.contentWindow)return;const A=Be();A!=="*"&&d.origin!==A||(m=!0,y(),X(),p(!1))},q=()=>{y(),p(!0)},Z=()=>{J()};return z.addEventListener("click",Z),t.addEventListener("error",q),c.addEventListener("message",K),Y(),ke(),()=>{y(),X(),t.removeEventListener("error",q),c.removeEventListener("message",K),z.removeEventListener("click",Z),P.remove()}},x="Markup AI Sidebar",$="clipboard-read; clipboard-write",ve="markupai.sidebarNextGen.overrideUrl",Ce="https://sidebar.markup.ai/";function be(e){try{return"localStorage"in globalThis&&globalThis.localStorage.getItem("markupai.sidebarNextGen.overrideUrl")?.trim()||e}catch{return e}}var j="markupai.sidebarNextGen.authOverride";function Se(e,t){if(!t)return e;try{if(!("localStorage"in globalThis))return e;const n=globalThis.localStorage.getItem(j)?.trim();if(!n)return e;const r=JSON.parse(n);return r!==null&&typeof r=="object"&&"type"in r&&(r.type==="mediation"||r.type==="popup")?r:e}catch{return e}}function we(e,t){try{return new URL(e).origin}catch(n){return t?.onInvalidUrl?.(e,n),"*"}}function Ee(e,t="Expected SidebarAdapter from createSidebarHost"){if(e.adapter===null)throw new Error(t)}function Pe(e){const{iframe:t,iframeMount:n}=e;if(t!==void 0&&n!==void 0)throw new Error("createSidebarHost: pass only one of `iframe` or `iframeMount`");if(t!==void 0)return{iframe:t,removeMountedIframe:null};if(n===void 0)throw new Error("createSidebarHost: pass either `iframe` or `iframeMount`");const{container:r,src:a,allow:o=$}=n,s=document.createElement("iframe");return s.title=x,s.src=a,o&&s.setAttribute("allow",o),r.appendChild(s),{iframe:s,removeMountedIframe:()=>{s.remove()}}}function Re(e){const{plugin:t,loadOverlayContainer:n,loadOverlayOptions:r,adapterOptions:a}=e,{iframe:o,removeMountedIframe:s}=Pe(e),l=n!==void 0?F(n,o,r??{}):null;if(t!==void 0){const c=new H(t,o,a);return{iframe:o,adapter:c,destroy:()=>{l?.(),c.destroy(),s?.()}}}return{iframe:o,adapter:null,destroy:()=>{l?.(),s?.()}}}var w="sidebarContainer",V="markupai-sidebar-host-shell-styles";function G(e){if(typeof CSS<"u"&&typeof CSS.escape=="function")return CSS.escape(e);if(!/^[a-zA-Z_][\w-]*$/.test(e))throw new Error(String.raw`sidebar host shell: containerId must match /^[a-zA-Z_][\w-]*$/ when CSS.escape is unavailable (got ${JSON.stringify(e)})`);return e}function E(e=w){const t=G(e);return`
114
+ `,Ie=e=>{const t=e??document;if(t.getElementById(U))return;const n=t.createElement("style");n.id=U,n.textContent=me,t.head.appendChild(n)},ye=8e3,Ae=12e3,F=(e,t,n={})=>{Ie(e.ownerDocument);const{sidebarUrl:i,targetOrigin:a,timeoutMs:o=ye,retryIntervalMs:s=Ae,messageListenWindow:l}=n,c=l??(typeof globalThis.window<"u"?globalThis.window:globalThis),f=()=>i??t.src,Be=()=>{if(a)return a;try{return new URL(f()).origin}catch{return"*"}},{overlay:P,button:z}=fe();e.appendChild(P);let m=!1,I,u;const p=d=>{P.style.display=d?"flex":"none"};p(!1);const y=()=>{I&&(globalThis.clearTimeout(I),I=void 0)},Y=()=>{y(),I=globalThis.setTimeout(()=>{m||p(!0)},o)},J=d=>{const A=d?.preserveOverlay??!0;m=!1,A||p(!1),t.src=f(),Y()},ke=()=>{u||s<=0||(u=globalThis.setInterval(()=>{m||J({preserveOverlay:!0})},s))},X=()=>{u&&(globalThis.clearInterval(u),u=void 0)},K=d=>{if(!t.contentWindow||d.source!==t.contentWindow)return;const A=Be();A!=="*"&&d.origin!==A||(m=!0,y(),X(),p(!1))},q=()=>{y(),p(!0)},Z=()=>{J()};return z.addEventListener("click",Z),t.addEventListener("error",q),c.addEventListener("message",K),Y(),ke(),()=>{y(),X(),t.removeEventListener("error",q),c.removeEventListener("message",K),z.removeEventListener("click",Z),P.remove()}},x="Markup AI Sidebar",$="clipboard-read; clipboard-write",ve="markupai.sidebarNextGen.overrideUrl",Ce="https://sidebar.markup.ai/";function be(e){try{return"localStorage"in globalThis&&globalThis.localStorage.getItem("markupai.sidebarNextGen.overrideUrl")?.trim()||e}catch{return e}}var j="markupai.sidebarNextGen.authOverride";function Se(e,t){if(!t)return e;try{if(!("localStorage"in globalThis))return e;const n=globalThis.localStorage.getItem(j)?.trim();if(!n)return e;const i=JSON.parse(n);return i!==null&&typeof i=="object"&&"type"in i&&(i.type==="mediation"||i.type==="popup")?i:e}catch{return e}}function we(e,t){try{return new URL(e).origin}catch(n){return t?.onInvalidUrl?.(e,n),"*"}}function Ee(e,t="Expected SidebarAdapter from createSidebarHost"){if(e.adapter===null)throw new Error(t)}function Pe(e){const{iframe:t,iframeMount:n}=e;if(t!==void 0&&n!==void 0)throw new Error("createSidebarHost: pass only one of `iframe` or `iframeMount`");if(t!==void 0)return{iframe:t,removeMountedIframe:null};if(n===void 0)throw new Error("createSidebarHost: pass either `iframe` or `iframeMount`");const{container:i,src:a,allow:o=$}=n,s=document.createElement("iframe");return s.title=x,s.src=a,o&&s.setAttribute("allow",o),i.appendChild(s),{iframe:s,removeMountedIframe:()=>{s.remove()}}}function Re(e){const{plugin:t,loadOverlayContainer:n,loadOverlayOptions:i,adapterOptions:a}=e,{iframe:o,removeMountedIframe:s}=Pe(e),l=n!==void 0?F(n,o,i??{}):null;if(t!==void 0){const c=new H(t,o,a);return{iframe:o,adapter:c,destroy:()=>{l?.(),c.destroy(),s?.()}}}return{iframe:o,adapter:null,destroy:()=>{l?.(),s?.()}}}var w="sidebarContainer",V="markupai-sidebar-host-shell-styles";function G(e){if(typeof CSS<"u"&&typeof CSS.escape=="function")return CSS.escape(e);if(!/^[a-zA-Z_][\w-]*$/.test(e))throw new Error(String.raw`sidebar host shell: containerId must match /^[a-zA-Z_][\w-]*$/ when CSS.escape is unavailable (got ${JSON.stringify(e)})`);return e}function E(e=w){const t=G(e);return`
115
115
  html {
116
116
  height: 100%;
117
117
  }
@@ -133,7 +133,7 @@ body {
133
133
  margin: 0;
134
134
  display: block;
135
135
  }
136
- `.trim()}var Te=E();function Oe(e){return e instanceof Document?e:e.ownerDocument}function _e(e,t,n){if(!t||e.getElementById(V))return;const r=e.createElement("style");r.id=V,r.textContent=E(n),e.head.appendChild(r)}function De(e){const{root:t=typeof document<"u"?document:void 0,containerId:n=w,includeDefaultStyles:r=!0}=e??{};if(t===void 0)throw new Error("ensureSidebarHostShell: no document — pass `root` in non-browser environments");const a=Oe(t);_e(a,r,n);const o=t instanceof Document?a.getElementById(n):t.querySelector(`#${G(n)}`);if(o instanceof HTMLElement&&(t instanceof Document||t.contains(o)))return o;if(!(t instanceof Document)){const l=a.createElement("div");return l.id=n,t.appendChild(l),l}const s=a.createElement("div");return s.id=n,a.body.appendChild(s),s}function W(){return' <meta name="viewport" content="width=device-width, initial-scale=1.0" />'}function Le(e){const{title:t="Markup AI Sidebar",headInnerHtml:n="",includePluginHostHead:r=!1,bodyScriptsHtml:a,htmlLang:o="en",htmlAttrs:s=`lang="${o}" style="height:100%"`,bodyAttrs:l='style="height:100%;margin:0"'}=e,c=[r?W():"",n].filter(f=>f.trim().length>0).join(`
136
+ `.trim()}var Te=E();function Oe(e){return e instanceof Document?e:e.ownerDocument}function _e(e,t,n){if(!t||e.getElementById(V))return;const i=e.createElement("style");i.id=V,i.textContent=E(n),e.head.appendChild(i)}function De(e){const{root:t=typeof document<"u"?document:void 0,containerId:n=w,includeDefaultStyles:i=!0}=e??{};if(t===void 0)throw new Error("ensureSidebarHostShell: no document — pass `root` in non-browser environments");const a=Oe(t);_e(a,i,n);const o=t instanceof Document?a.getElementById(n):t.querySelector(`#${G(n)}`);if(o instanceof HTMLElement&&(t instanceof Document||t.contains(o)))return o;if(!(t instanceof Document)){const l=a.createElement("div");return l.id=n,t.appendChild(l),l}const s=a.createElement("div");return s.id=n,a.body.appendChild(s),s}function W(){return' <meta name="viewport" content="width=device-width, initial-scale=1.0" />'}function Le(e){const{title:t="Markup AI Sidebar",headInnerHtml:n="",includePluginHostHead:i=!1,bodyScriptsHtml:a,htmlLang:o="en",htmlAttrs:s=`lang="${o}" style="height:100%"`,bodyAttrs:l='style="height:100%;margin:0"'}=e,c=[i?W():"",n].filter(f=>f.trim().length>0).join(`
137
137
  `);return`<!DOCTYPE html>
138
138
  <html ${s}>
139
139
  <head>
@@ -146,4 +146,4 @@ ${c}`:""}
146
146
  ${a}
147
147
  </body>
148
148
  </html>
149
- `}function Me(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}i.ADAPTER_VERSION=R,i.AUTH_CONFIG_OVERRIDE_STORAGE_KEY=j,i.DEFAULT_IPC_CONFIG=B,i.DEFAULT_SIDEBAR_CONFIG=ne,i.DeferredPromise=M,i.IPCCore=b,i.MimeType=g,i.PluginAdapter=pe,i.PluginIPCAdapter=k,i.ReplaceBatchError=v,i.SIDEBAR_DEFAULT_PRODUCTION_BASE_URL=Ce,i.SIDEBAR_HOST_CONTAINER_ID=w,i.SIDEBAR_HOST_SHELL_CSS=Te,i.SIDEBAR_IFRAME_DEFAULT_ALLOW=$,i.SIDEBAR_IFRAME_DEFAULT_TITLE=x,i.SIDEBAR_URL_OVERRIDE_STORAGE_KEY=ve,i.SidebarAdapter=H,i.SidebarIPCAdapter=N,i.TEXT_MIME_TYPES=te,i.TextLookupError=h,i.assertSidebarHostAdapter=Ee,i.buildDocumentReference=le,i.buildSidebarHostHtmlDocument=Le,i.buildSidebarHostShellCss=E,i.buildSidebarPluginHostHeadInnerHtml=W,i.createSidebarHost=Re,i.ensureSidebarHostShell=De,i.getAuthConfigWithOverride=Se,i.getSidebarBaseUrlWithOverride=be,i.ipcErrorReconstructors=C,i.isDocumentReference=se,i.isIntegrationSettingField=ie,i.isIntegrationSettingsSchema=re,i.isReplaceBatchError=ae,i.isTextLookupError=oe,i.reconstructError=_,i.setupSidebarLoadOverlay=F,i.sidebarPostMessageTargetOrigin=we});
149
+ `}function Me(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}r.ADAPTER_VERSION=R,r.AUTH_CONFIG_OVERRIDE_STORAGE_KEY=j,r.DEFAULT_IPC_CONFIG=B,r.DEFAULT_SIDEBAR_CONFIG=ne,r.DeferredPromise=M,r.IPCCore=b,r.MimeType=g,r.PluginAdapter=pe,r.PluginIPCAdapter=k,r.ReplaceBatchError=v,r.SIDEBAR_DEFAULT_PRODUCTION_BASE_URL=Ce,r.SIDEBAR_HOST_CONTAINER_ID=w,r.SIDEBAR_HOST_SHELL_CSS=Te,r.SIDEBAR_IFRAME_DEFAULT_ALLOW=$,r.SIDEBAR_IFRAME_DEFAULT_TITLE=x,r.SIDEBAR_URL_OVERRIDE_STORAGE_KEY=ve,r.SidebarAdapter=H,r.SidebarIPCAdapter=N,r.TEXT_MIME_TYPES=te,r.TextLookupError=h,r.assertSidebarHostAdapter=Ee,r.buildDocumentReference=le,r.buildSidebarHostHtmlDocument=Le,r.buildSidebarHostShellCss=E,r.buildSidebarPluginHostHeadInnerHtml=W,r.createSidebarHost=Re,r.ensureSidebarHostShell=De,r.getAuthConfigWithOverride=Se,r.getSidebarBaseUrlWithOverride=be,r.ipcErrorReconstructors=C,r.isDocumentReference=se,r.isIntegrationSettingField=re,r.isIntegrationSettingsSchema=ie,r.isReplaceBatchError=ae,r.isTextLookupError=oe,r.reconstructError=_,r.setupSidebarLoadOverlay=F,r.sidebarPostMessageTargetOrigin=we});
@@ -1,7 +1,7 @@
1
- import { SidebarAdapter, type SidebarAdapterOptions } from "../adapters/sidebarAdapter";
2
- import { type SidebarLoadOverlayOptions } from "../load-overlay";
3
- import type { AuthConfig } from "../types/common";
4
- import type { PluginInterface } from "../types/pluginInterface";
1
+ import { SidebarAdapter, type SidebarAdapterOptions } from "../adapters/sidebarAdapter.js";
2
+ import { type SidebarLoadOverlayOptions } from "../load-overlay/index.js";
3
+ import type { AuthConfig } from "../types/common.js";
4
+ import type { PluginInterface } from "../types/pluginInterface.js";
5
5
  /** Fixed `iframe.title` for accessibility on adapter-created sidebars. */
6
6
  export declare const SIDEBAR_IFRAME_DEFAULT_TITLE = "Markup AI Sidebar";
7
7
  /** Default `iframe.allow` so the embedded sidebar can use the clipboard (Permissions Policy). */
@@ -34,6 +34,25 @@ export type ContentReplacement = {
34
34
  suggestion: string;
35
35
  range: ContentRange;
36
36
  };
37
+ /**
38
+ * A comment the sidebar asks the host to anchor on a span of the document
39
+ * (see {@link PluginInterface.addComment}).
40
+ */
41
+ export interface CommentRequest {
42
+ /**
43
+ * Ready-to-post plain-text comment body composed by the sidebar. Hosts can
44
+ * post it as-is or build their own body from {@link CommentRequest.issue}.
45
+ * It carries no author information — the host attributes the comment.
46
+ */
47
+ text: string;
48
+ /**
49
+ * Half-open document span `[range.start, range.end)` to anchor the comment
50
+ * on — same offset semantics as `replaceContent` / `selectContent`.
51
+ */
52
+ range: ContentRange;
53
+ /** The issue the comment is about, for hosts that format their own body. */
54
+ issue?: AgenticIssuePayload;
55
+ }
37
56
  /**
38
57
  * Content information including the content, document reference, optional document name, and optional mime type
39
58
  * The integration must provide content and documentReference - documentName and mimeType are optional
@@ -184,6 +203,17 @@ export interface SidebarConfig {
184
203
  * If false, the selection toggle UI will be hidden and checkSelectionEnabled will be forced to false
185
204
  */
186
205
  supportCheckSelection?: boolean;
206
+ /**
207
+ * Whether the host can anchor a comment on a span of the document via
208
+ * {@link PluginInterface.addComment}.
209
+ *
210
+ * When `true`, the sidebar offers an "Add as Comment" action on open issue
211
+ * cards. When `false` or omitted (the default), the action is hidden. Only
212
+ * set it when the host implements `addComment` — and, where the editor's
213
+ * comment API is version-gated (e.g. Word's `WordApi 1.4`), only when that
214
+ * API is actually available.
215
+ */
216
+ supportComments?: boolean;
187
217
  /**
188
218
  * Whether the sidebar may run several agents concurrently in one check.
189
219
  *
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAEvE;;;;GAIG;AACH,oBAAY,QAAQ;IAClB,UAAU,eAAe;IACzB,aAAa,kBAAkB;IAC/B,SAAS,cAAc;IACvB,oBAAoB,yBAAyB;CAC9C;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,2GAKlB,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,YAAY,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;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C;CACd;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAC;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yGAAyG;IACzG,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB"}
@@ -1 +1 @@
1
- {"version":3,"file":"integrationSettings.d.ts","sourceRoot":"","sources":["../../src/types/integrationSettings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;GAOG;AACH,MAAM,WAAW,2BAA2B;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,8BAA+B,SAAQ,2BAA2B;IACjF,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,4BAA4B;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,WAAW,2BAA4B,SAAQ,2BAA2B;IAC9E,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,aAAa,CAAC,4BAA4B,CAAC,CAAC;CACtD;AAED;;;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,4BAA4B,GAAG,IAAI,CAAC,CAAC;CACnE;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,+BAA+B,GAAG,MAAM,CAAC;AAErD,MAAM,WAAW,6BAA6B;IAC5C,MAAM,EAAE,+BAA+B,CAAC;CACzC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,yBAAyB,CAAC;IAClC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,4BAA4B,CAAC,CAAC;CAC3D;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,2BAA2B,UAAW,OAAO,KAAG,KAAK,IAAI,yBAIrE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,UAAW,OAAO,KAAG,KAAK,IAAI,uBAmBnE,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { ContentRange, ContentReplacement, ContentInfo, SidebarConfig, SidebarBuildInfo, AgenticIssuePayload } from "./common";
1
+ import type { CommentRequest, ContentRange, ContentReplacement, ContentInfo, SidebarConfig, SidebarBuildInfo, AgenticIssuePayload } from "./common";
2
2
  import type { IntegrationSettingsValues, IntegrationSettingsChangeMeta } from "./integrationSettings";
3
3
  /**
4
4
  * Interface for the functions to implement in the Editor that the Sidebar will call via IPC
@@ -154,6 +154,31 @@ export interface PluginInterface {
154
154
  * clipboard; reject to signal the write failed.
155
155
  */
156
156
  copyToClipboard?: (text: string) => Promise<void>;
157
+ /**
158
+ * Anchor a comment on a span of the document — e.g. Word's
159
+ * `Range.insertComment`. The sidebar calls this when the user picks
160
+ * **Add as Comment** on an issue card.
161
+ *
162
+ * Optional. Implement it together with
163
+ * {@link SidebarConfig.supportComments} `: true`; the sidebar only offers
164
+ * the action when that flag is set. Without a handler, the call rejects
165
+ * with `No receiver registered for: addComment`.
166
+ *
167
+ * The handler MUST NOT change the document text. Author attribution is the
168
+ * host's responsibility — the sidebar sends no user information, and
169
+ * editors typically attach the signed-in editor user themselves.
170
+ *
171
+ * @param comment - Composed plain-text body, the half-open range to anchor
172
+ * on (same semantics as `replaceContent`'s `range`), and the structured
173
+ * issue for hosts that build their own body.
174
+ * @param documentReference - The document to comment in. Omitted or `null`
175
+ * means the integration's currently active document.
176
+ * @returns Promise that resolves once the comment has been added
177
+ * @throws {TextLookupError} When the range cannot be located in the document
178
+ * @throws {Error} When the host cannot comment there (e.g. a protected
179
+ * document); its `message` is shown to the user on the issue card
180
+ */
181
+ addComment?: (comment: CommentRequest, documentReference?: string | null) => Promise<void>;
157
182
  /**
158
183
  * Called when the user changes a value in the integration-settings form
159
184
  * declared via {@link SidebarConfig.integrationSettings}.
@@ -1 +1 @@
1
- {"version":3,"file":"pluginInterface.d.ts","sourceRoot":"","sources":["../../src/types/pluginInterface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EACV,yBAAyB,EACzB,6BAA6B,EAC9B,MAAM,uBAAuB,CAAC;AAE/B;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;;OAMG;IACH,UAAU,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;IAEvC;;;;;OAKG;IACH,kBAAkB,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;IAE/C;;;;;;;;OAQG;IACH,cAAc,EAAE,CACd,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,YAAY,EACnB,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,KAC9B,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnB;;;;;;;OAOG;IACH,aAAa,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzF;;;;;;;OAOG;IACH,uBAAuB,EAAE,CAAC,YAAY,EAAE,kBAAkB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I,CAAC,CAAC;IAE9E;;;;;;;;;;;OAWG;IACH,2BAA2B,CAAC,EAAE,CAC5B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,QAAQ,GAAG,UAAU,GAAG,WAAW,EAC3C,MAAM,EAAE,MAAM,GAAG,MAAM,KACpB,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,sBAAsB,CAAC,EAAE,CAAC,iBAAiB,EAAE,MAAM,GAAG,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7E;;;;;;;;;;;;;;;;;OAiBG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7C;;;;;;;;;;;;;;;;OAgBG;IACH,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAElD;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,EAAE,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3F;;;;;;;;;;;OAWG;IACH,2BAA2B,CAAC,EAAE,CAC5B,MAAM,EAAE,yBAAyB,EACjC,IAAI,EAAE,6BAA6B,KAChC,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markupai/sidebar-adapter",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "Adapter package for MarkupAI Sidebar integration",
5
5
  "keywords": [
6
6
  "markupai",
@@ -46,7 +46,7 @@
46
46
  "@asyncapi/parser": "^3.6.3",
47
47
  "ajv": "^8.20.0",
48
48
  "ts-json-schema-generator": "^2.9.0",
49
- "tsc-alias": "1.9.4"
49
+ "tsc-alias": "1.9.7"
50
50
  },
51
51
  "publishConfig": {
52
52
  "access": "public"