article-content-renderer-vue2 0.1.0 → 0.2.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/README.md CHANGED
@@ -110,72 +110,67 @@ import 'article-content-renderer-vue2/style.css'
110
110
  Vue.use(ArticleContentRendererPlugin)
111
111
  ```
112
112
 
113
- ## 广告与图片地址
113
+ ## 自定义插槽与图片地址
114
114
 
115
- 广告参数与 React 版保持一致:
115
+ 通过 `customSlots` 描述插槽位置,再使用与 `id` 同名的具名插槽传入任意 Vue 内容:
116
116
 
117
117
  ```ts
118
- interface AdConfig {
119
- adm?: readonly unknown[]
120
- ads?: readonly unknown[]
121
- loc: readonly number[]
122
- }
123
-
124
- interface PubId {
125
- adm: string
126
- ads: string
118
+ interface CustomSlot {
119
+ id: string
120
+ location: number
127
121
  }
128
122
  ```
129
123
 
130
124
  ```vue
131
- <ArticleContentRenderer
132
- :document="article"
133
- :ad-conf="{
134
- adm: ['banner-1', 'banner-2'],
135
- ads: ['123', '456'],
136
- loc: [2, 5],
137
- }"
138
- :pubid="{
139
- adm: '/23054585162/newsflowly/',
140
- ads: '3887371527059481',
141
- }"
142
- ad-title="Advertisement"
143
- image-base-url="https://cdn.example.com/"
144
- @render-error="handleRenderError"
145
- />
146
- ```
147
-
148
- `loc` 使用从 1 开始的 `document.content` 顶层位置,广告会插入在对应元素前面。位置超出文档长度时直接忽略。每个非空 `adm`/`ads` 数组的长度都必须与 `loc` 一致,否则不生成广告占位,并通过 `render-error` 上报 `AD_CONFIG_LENGTH_MISMATCH`。
149
-
150
- 广告选择规则:
151
-
152
- - 同一位置同时有 `adm` 和 `ads`:先请求 ADM;只有 ADM 返回空广告时才请求对应 AdSense。
153
- - 只有 `adm`:只请求 ADM,空广告也不回退。
154
- - 只有 `ads`:直接请求 AdSense。
155
-
156
- 宿主项目需要分别加载一次 Google Publisher Tag 和 Google AdSense SDK。组件通过 `googletag.cmd` 和 `adsbygoogle` 队列请求广告,不会为每个广告位重复插入 `<script>`。
157
-
158
- ADM 和 AdSense 共用稳定的全局 class,样式由宿主项目覆盖:
125
+ <script lang="ts">
126
+ import Vue from 'vue'
127
+ import type { CustomSlot } from 'article-content-renderer-vue2'
159
128
 
160
- ```css
161
- .article-ad-wrapper {
162
- max-width: 728px;
163
- height: 110px;
164
- margin: 0 auto;
165
- }
129
+ export default Vue.extend({
130
+ data() {
131
+ return {
132
+ customSlots: [
133
+ { id: 'article-ad-1', location: 2 },
134
+ { id: 'recommendation', location: 5 },
135
+ { id: 'article-ad-2', location: 5 },
136
+ ] as CustomSlot[],
137
+ }
138
+ },
139
+ })
140
+ </script>
166
141
 
167
- .article-ad-title {
168
- flex-shrink: 0;
169
- font-size: 12px;
170
- line-height: 20px;
171
- text-align: center;
172
- }
142
+ <template>
143
+ <ArticleContentRenderer
144
+ :document="article"
145
+ :custom-slots="customSlots"
146
+ >
147
+ <template #article-ad-1>
148
+ <MyAd slot-id="top" />
149
+ </template>
150
+
151
+ <template #recommendation>
152
+ <RecommendationCard />
153
+ </template>
154
+
155
+ <template #article-ad-2>
156
+ <MyAd slot-id="middle" />
157
+ </template>
158
+ </ArticleContentRenderer>
159
+ </template>
173
160
  ```
174
161
 
175
- 外层使用纵向 flex 布局,广告单元自动占满标题之外的剩余高度。上例中外层为 `110px`、标题为 `20px`,广告实际高度为 `90px`。如果宿主使用 `<style scoped>`,请使用 Vue 2 的深度选择器,或将这些广告规则放到非 scoped 样式中。
162
+ 插槽规则:
163
+
164
+ - `location` 从 1 开始;`location: 5` 表示插入到 `document.content[4]` 之前。
165
+ - 同一个 `location` 可以配置多个不同 `id`,并按照数组中的顺序渲染。
166
+ - `id` 应当唯一,并且必须与具名插槽名称一致。
167
+ - 非正整数或超过 `document.content` 长度的位置会被忽略。
168
+ - 渲染器不会为插槽额外创建包装 DOM,样式和生命周期由插槽组件自行控制。
169
+ - 具名插槽会收到 `{ id, location }` 作为作用域参数。
176
170
 
177
- `adTitle` 默认为 `Advertisement`。`imageBaseUrl` 默认为 `https://www.doitme.link/`;传入新地址时,只替换文档图片中该默认前缀,其他图片 URL 保持不变。
171
+ 广告组件也通过具名插槽传入,并自行负责 SDK 加载、广告请求、空广告回退、唯一 DOM ID 和卸载清理。
178
172
 
173
+ `imageBaseUrl` 默认为 `https://www.doitme.link/`;传入新地址时,只替换文档图片中该默认前缀,其他图片 URL 保持不变。
179
174
  ## articleButton 链接
180
175
 
181
176
  `style: "button"` 和 `style: "text"` 都使用 `<a>` 渲染,只改变视觉样式。resolver 接收当前节点的完整只读属性:
@@ -257,9 +252,7 @@ function handleArticleButtonClick(payload: ArticleButtonClickPayload): void {
257
252
  | `document` | `unknown` | 必填 | Article Content Protocol 文档 |
258
253
  | `protocolVersion` | `number` | `1` | 协议适配器版本 |
259
254
  | `strict` | `boolean` | `false` | 校验失败时是否停止整篇正文渲染 |
260
- | `adConf` | `AdConfig` | `{ adm: [], ads: [], loc: [] }` | 广告配置;非空广告数组长度须与 `loc` 一致 |
261
- | `pubid` | `PubId` | `{ adm: '', ads: '' }` | ADM/AdSense 发布标识 |
262
- | `adTitle` | `string` | `"Advertisement"` | ADM 和 AdSense 共用的广告标题 |
255
+ | `customSlots` | `CustomSlot[]` | `[]` | 配置一个或多个具名插槽的顶层正文插入位置 |
263
256
  | `imageBaseUrl` | `string` | `"https://www.doitme.link/"` | 替换文档图片的默认地址前缀 |
264
257
  | `resolveArticleButtonLink` | `ResolveArticleButtonLink` | `undefined` | 由使用者生成 articleButton 完整链接 |
265
258
 
@@ -1 +1 @@
1
- :root{--acp-color-text: inherit;--acp-color-muted: #667085;--acp-color-border: #d0d5dd;--acp-color-surface: #f8fafc;--acp-color-accent: #2563eb;--acp-color-accent-hover: #1d4ed8;--acp-color-on-accent: #ffffff;--acp-radius: .375rem;--acp-spacing-block: 1rem;--acp-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace}.acp-document{display:contents}.acp-paragraph,.acp-heading,.acp-blockquote,.acp-list,.acp-code-block,.acp-horizontal-rule,.acp-image,.acp-article-button,.acp-table-wrapper{box-sizing:border-box}.acp-paragraph,.acp-heading,.acp-blockquote,.acp-list,.acp-code-block,.acp-horizontal-rule,.acp-image,.acp-table-wrapper{margin-block:0 var(--acp-spacing-block)}.acp-paragraph:first-child,.acp-heading:first-child,.acp-blockquote:first-child,.acp-list:first-child,.acp-code-block:first-child,.acp-horizontal-rule:first-child,.acp-image:first-child,.acp-table-wrapper:first-child{margin-block-start:0}.acp-paragraph{color:var(--acp-color-text)}.acp-blockquote{margin-inline:0;padding-inline-start:1rem;border-inline-start:.25rem solid var(--acp-color-border);color:var(--acp-color-muted)}.acp-list{padding-inline-start:1.5rem}.acp-list-item>:last-child{margin-block-end:0}.acp-code-block{overflow-x:auto;padding:1rem;border-radius:var(--acp-radius);background:var(--acp-color-surface);font-family:var(--acp-font-mono);white-space:pre}.acp-mark--code{padding:.1em .25em;border-radius:calc(var(--acp-radius) / 2);background:var(--acp-color-surface);font-family:var(--acp-font-mono)}.acp-horizontal-rule{border:0;border-block-start:1px solid var(--acp-color-border)}.acp-image{display:flex;width:100%}.acp-image--left{justify-content:flex-start}.acp-image--center{justify-content:center}.acp-image--right{justify-content:flex-end}.acp-image__element{display:block;max-width:100%;height:auto}.acp-link,.acp-article-button--text{color:var(--acp-color-accent);text-decoration:underline;text-underline-offset:.15em}.acp-link:hover,.acp-article-button--text:hover{color:var(--acp-color-accent-hover)}.acp-article-button{display:inline-flex;align-items:center;justify-content:center;margin-block:0 var(--acp-spacing-block);cursor:pointer}.acp-article-button--button{min-height:2.5rem;padding:.5rem 1rem;border-radius:var(--acp-radius);background:var(--acp-color-accent);color:var(--acp-color-on-accent);text-decoration:none}.acp-article-button--button:hover{background:var(--acp-color-accent-hover)}.acp-article-button--disabled{cursor:not-allowed;opacity:.55}.acp-table-wrapper{width:100%;overflow-x:auto}.acp-ad-slot{box-sizing:border-box;width:100%}.article-ad-wrapper{display:flex;flex-direction:column;overflow:hidden}.article-ad-title{flex:0 0 auto}.article-ad-unit{flex:1 1 0;min-height:0;width:100%}.acp-table{width:100%;border-collapse:collapse}.acp-table-cell{padding:.625rem .75rem;border:1px solid var(--acp-color-border);vertical-align:top}.acp-table-cell>:last-child{margin-block-end:0}.acp-render-error{padding:.75rem 1rem;border:1px solid #fda29b;border-radius:var(--acp-radius);background:#fffbfa;color:#b42318}
1
+ :root{--acp-color-text: inherit;--acp-color-muted: #667085;--acp-color-border: #d0d5dd;--acp-color-surface: #f8fafc;--acp-color-accent: #2563eb;--acp-color-accent-hover: #1d4ed8;--acp-color-on-accent: #ffffff;--acp-radius: .375rem;--acp-spacing-block: 1rem;--acp-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace}.acp-document{display:contents}.acp-paragraph,.acp-heading,.acp-blockquote,.acp-list,.acp-code-block,.acp-horizontal-rule,.acp-image,.acp-article-button,.acp-table-wrapper{box-sizing:border-box}.acp-paragraph,.acp-heading,.acp-blockquote,.acp-list,.acp-code-block,.acp-horizontal-rule,.acp-image,.acp-table-wrapper{margin-block:0 var(--acp-spacing-block)}.acp-paragraph:first-child,.acp-heading:first-child,.acp-blockquote:first-child,.acp-list:first-child,.acp-code-block:first-child,.acp-horizontal-rule:first-child,.acp-image:first-child,.acp-table-wrapper:first-child{margin-block-start:0}.acp-paragraph{color:var(--acp-color-text)}.acp-blockquote{margin-inline:0;padding-inline-start:1rem;border-inline-start:.25rem solid var(--acp-color-border);color:var(--acp-color-muted)}.acp-list{padding-inline-start:1.5rem}.acp-list-item>:last-child{margin-block-end:0}.acp-code-block{overflow-x:auto;padding:1rem;border-radius:var(--acp-radius);background:var(--acp-color-surface);font-family:var(--acp-font-mono);white-space:pre}.acp-mark--code{padding:.1em .25em;border-radius:calc(var(--acp-radius) / 2);background:var(--acp-color-surface);font-family:var(--acp-font-mono)}.acp-horizontal-rule{border:0;border-block-start:1px solid var(--acp-color-border)}.acp-image{display:flex;width:100%}.acp-image--left{justify-content:flex-start}.acp-image--center{justify-content:center}.acp-image--right{justify-content:flex-end}.acp-image__element{display:block;max-width:100%;height:auto}.acp-link,.acp-article-button--text{color:var(--acp-color-accent);text-decoration:underline;text-underline-offset:.15em}.acp-link:hover,.acp-article-button--text:hover{color:var(--acp-color-accent-hover)}.acp-article-button{display:inline-flex;align-items:center;justify-content:center;margin-block:0 var(--acp-spacing-block);cursor:pointer}.acp-article-button--button{min-height:2.5rem;padding:.5rem 1rem;border-radius:var(--acp-radius);background:var(--acp-color-accent);color:var(--acp-color-on-accent);text-decoration:none}.acp-article-button--button:hover{background:var(--acp-color-accent-hover)}.acp-article-button--disabled{cursor:not-allowed;opacity:.55}.acp-table-wrapper{width:100%;overflow-x:auto}.acp-table{width:100%;border-collapse:collapse}.acp-table-cell{padding:.625rem .75rem;border:1px solid var(--acp-color-border);vertical-align:top}.acp-table-cell>:last-child{margin-block-end:0}.acp-render-error{padding:.75rem 1rem;border:1px solid #fda29b;border-radius:var(--acp-radius);background:#fffbfa;color:#b42318}
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var Y=Object.defineProperty,G=Object.defineProperties;var H=Object.getOwnPropertyDescriptors;var v=Object.getOwnPropertySymbols;var W=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable;var k=(i,e,t)=>e in i?Y(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,m=(i,e)=>{for(var t in e||(e={}))W.call(e,t)&&k(i,t,e[t]);if(v)for(var t of v(e))Q.call(e,t)&&k(i,t,e[t]);return i},S=(i,e)=>G(i,H(e));var O=(i,e,t)=>k(i,typeof e!="symbol"?e+"":e,t);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const N=require("vue"),X=new Set(["http:","https:","mailto:","tel:"]),J=new Set(["http:","https:","blob:"]),Z="https://article-content-renderer.invalid/",I="https://www.doitme.link/";function tt(i,e){if(typeof i!="string")return i;const t=i.trim();if(!t.startsWith(I))return t;const n=(e.trim()||I).replace(/\/+$/u,""),s=t.slice(I.length).replace(/^\/+/,"");return`${n}/${s}`}function E(i,e){if(typeof i!="string")return null;const t=i.trim();if(!t||/[\u0000-\u001F\u007F]/u.test(t))return null;try{const r=new URL(t,Z);return(e==="link"?X:J).has(r.protocol)?t:null}catch(r){return null}}function D(i,e){const t=new Set(typeof i=="string"?i.trim().split(/\s+/u).filter(Boolean):[]);return e==="_blank"&&(t.add("noopener"),t.add("noreferrer")),t.size>0?[...t].join(" "):void 0}function et(i){const e=i.trim();return e?e.startsWith("ca-pub-")?e:`ca-pub-${e}`:""}const x=N.extend({name:"ArticleAdSenseAd",props:{publisherId:{type:String,required:!0},slotId:{type:[String,Number],required:!0},title:{type:String,default:"Advertisement"}},data(){return{observer:null,requestedKey:null}},computed:{adClient(){return et(this.publisherId)},adSlot(){return String(this.slotId).trim()},requestKey(){return`${this.adClient}:${this.adSlot}`}},watch:{requestKey(){this.requestedKey=null,this.stopObserver(),this.$nextTick(()=>this.startObserver())}},mounted(){this.startObserver()},beforeDestroy(){this.stopObserver()},methods:{requestAd(){var i;if(!(!this.adClient||!this.adSlot||this.requestedKey===this.requestKey))try{const e=window;((i=e.adsbygoogle)!=null?i:e.adsbygoogle=[]).push({}),this.requestedKey=this.requestKey}catch(e){console.error("[ArticleContentRenderer] Failed to request AdSense ad:",e)}},startObserver(){const i=this.$refs.root;if(!(!i||!this.adClient||!this.adSlot)){if(typeof IntersectionObserver=="undefined"){this.requestAd();return}this.observer=new IntersectionObserver(e=>{e.some(t=>t.isIntersecting)&&(this.requestAd(),this.stopObserver())},{rootMargin:"200px 0px"}),this.observer.observe(i)}},stopObserver(){var i;(i=this.observer)==null||i.disconnect(),this.observer=null}},render(i){return!this.adClient||!this.adSlot?i():i("div",{ref:"root",staticClass:"article-ad-wrapper",attrs:{"data-google-ad":"true"}},[i("div",{staticClass:"article-ad-title"},this.title),i("ins",{key:this.requestKey,staticClass:"adsbygoogle article-ad-unit",style:{display:"block",width:"100%"},attrs:{"data-ad-client":this.adClient,"data-ad-slot":this.adSlot}})])}});function C(){var e;const i=window;return(e=i.googletag)!=null||(i.googletag={cmd:[]}),i.googletag}function rt(i,e){const t=i.trim().replace(/\/+$/u,""),r=e.replace(/^\/+|\/+$/gu,"");return t&&r?`${t}/${r}`:""}const it=N.extend({name:"ArticleAdManagerAd",props:{publisherId:{type:String,required:!0},slotId:{type:[String,Number],required:!0},title:{type:String,default:"Advertisement"},fallbackPublisherId:{type:String,default:""},fallbackSlotId:{type:[String,Number],default:void 0}},data(){return{observer:null,definedSlot:null,pubAdsService:null,slotRenderEnded:null,emptyAdmKey:null,cancelled:!1}},computed:{admSlotId(){return String(this.slotId).trim()},adsSlotId(){return this.fallbackSlotId===void 0?"":String(this.fallbackSlotId).trim()},adUnitPath(){return rt(this.publisherId,this.admSlotId)},fallbackKey(){return`${this.adUnitPath}:${this.admSlotId}:${this.fallbackPublisherId}:${this.adsSlotId}`},hasAdSenseFallback(){return!!(this.fallbackPublisherId.trim()&&this.adsSlotId)},shouldUseAdSense(){return this.hasAdSenseFallback&&this.emptyAdmKey===this.fallbackKey}},watch:{fallbackKey(){this.restartAdManager()}},mounted(){this.startObserver()},beforeDestroy(){this.cleanupAdManager()},methods:{restartAdManager(){this.cleanupAdManager(),this.emptyAdmKey=null,this.$nextTick(()=>this.startObserver())},startObserver(){const i=this.$refs.root;if(!(!i||!this.adUnitPath||!this.admSlotId||this.shouldUseAdSense)){if(this.cancelled=!1,typeof IntersectionObserver=="undefined"){this.requestAd();return}this.observer=new IntersectionObserver(e=>{var t;e.some(r=>r.isIntersecting)&&(this.requestAd(),(t=this.observer)==null||t.disconnect(),this.observer=null)},{rootMargin:"200px 0px"}),this.observer.observe(i)}},requestAd(){const i=this.$refs.unit;if(!i)return;const e=C();e.cmd.push(()=>{if(this.cancelled)return;const t=i.clientWidth,r=i.clientHeight,n=t>0&&r>0?["fluid",[t,r]]:"fluid",s=e.defineSlot(this.adUnitPath,n,this.admSlotId);if(!s)return;const a=e.pubads(),o=c=>{if(this.cancelled||c.slot!==s||!c.isEmpty||!this.hasAdSenseFallback)return;const d=this.fallbackKey;this.cleanupAdManager(),this.emptyAdmKey=d};this.definedSlot=s,this.pubAdsService=a,this.slotRenderEnded=o,a.addEventListener("slotRenderEnded",o),s.addService(a),e.enableServices(),e.display(this.admSlotId)})},cleanupAdManager(){var n;this.cancelled=!0,(n=this.observer)==null||n.disconnect(),this.observer=null;const i=this.definedSlot,e=this.pubAdsService,t=this.slotRenderEnded;if(this.definedSlot=null,this.pubAdsService=null,this.slotRenderEnded=null,!i&&!t)return;const r=C();r.cmd.push(()=>{var s,a;e&&t&&((s=e.removeEventListener)==null||s.call(e,"slotRenderEnded",t)),i&&((a=r.destroySlots)==null||a.call(r,[i]))})}},render(i){return this.shouldUseAdSense?i(x,{props:{publisherId:this.fallbackPublisherId,slotId:this.adsSlotId,title:this.title}}):!this.adUnitPath||!this.admSlotId?i():i("div",{ref:"root",staticClass:"article-ad-wrapper article-adm-wrapper",attrs:{"data-google-ad-manager":"true","data-ad-unit-path":this.adUnitPath}},[i("div",{staticClass:"article-ad-title"},this.title),i("div",{ref:"unit",staticClass:"article-ad-unit article-adm-unit",attrs:{id:this.admSlotId}})])}}),nt=new Set(["paragraph","heading","blockquote","bulletList","orderedList","codeBlock","horizontalRule","image","articleButton","table"]);function g(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function R(i){return g(i)?i:{}}function h(i,e,t,r){var c;const n=g(t)?t:{},s=g(t)?r:t,a={},o={};for(const[d,f]of Object.entries(n))if(d==="class")a.class=f;else if(d==="style")a.style=f;else if(d.startsWith("on")&&typeof f=="function"){const F=d.slice(2).toLowerCase();a.on=S(m({},(c=a.on)!=null?c:{}),{[F]:f})}else f!==void 0&&f!==!1&&(o[d]=f);return Object.keys(o).length>0&&(a.attrs=o),i.createElement(e,a,s)}function y(i){return Array.isArray(i)?i:[]}function p(i,...e){return`${i}/${e.map(String).join("/")}`}function q(i){return i==="left"||i==="center"||i==="right"||i==="justify"}function st(i){return i==="left"||i==="center"||i==="right"}function L(i){return i==="_blank"||i==="_self"}function A(i,e){i.reportIssue(e)}function at(i,e,t){if(!g(i)||i.type!=="text"||typeof i.text!="string"||!i.text)return null;let r=i.text;const n=y(i.marks);for(let s=0;s<n.length;s+=1){const a=n[s];if(!g(a)||typeof a.type!="string")continue;const o=p(e,"marks",s);switch(a.type){case"bold":r=h(t,"strong",{class:"acp-mark acp-mark--bold"},[r]);break;case"italic":r=h(t,"em",{class:"acp-mark acp-mark--italic"},[r]);break;case"strike":r=h(t,"s",{class:"acp-mark acp-mark--strike"},[r]);break;case"underline":r=h(t,"u",{class:"acp-mark acp-mark--underline"},[r]);break;case"code":r=h(t,"code",{class:"acp-mark acp-mark--code"},[r]);break;case"link":{const c=R(a.attrs),d=E(c.href,"link");if(!d){A(t,{code:"UNSAFE_URL",path:p(o,"attrs","href"),message:"The link URL is empty, malformed, or uses a disallowed protocol.",nodeType:"link"});break}const f=L(c.target)?c.target:"_blank";r=h(t,"a",{class:"acp-link",href:d,target:f,rel:D(void 0,f)},[r]);break}}}return r}function w(i,e,t){return y(i).map((r,n)=>at(r,p(e,n),t)).filter(r=>r!==null)}function B(i,e,t){return!g(i)||i.type!=="listItem"?null:h(t,"li",{class:"acp-list-item","data-node-type":"listItem"},P(i.content,p(e,"content"),t))}function ot(i,e,t){return!g(i)||i.type!=="tableCell"?null:h(t,"td",{class:"acp-table-cell","data-node-type":"tableCell"},P(i.content,p(e,"content"),t))}function lt(i,e,t){if(!g(i)||i.type!=="tableRow")return null;const r=y(i.content).map((n,s)=>ot(n,p(e,"content",s),t)).filter(n=>n!==null);return h(t,"tr",{class:"acp-table-row","data-node-type":"tableRow"},r)}function dt(i){var n;if(g(i)&&i.target!==void 0&&!L(i.target)||g(i)&&i.rel!==void 0&&typeof i.rel!="string")return null;const e=typeof i=="string"?{href:i}:g(i)&&typeof i.href=="string"?m(m({href:i.href},L(i.target)?{target:i.target}:{}),typeof i.rel=="string"?{rel:i.rel}:{}):null;if(!e)return null;const t=E(e.href,"link");if(!t)return null;const r=(n=e.target)!=null?n:"_self";return{href:t,target:r,rel:D(e.rel,r)}}function ct(i,e,t){var c;const r=R(i.attrs);if(typeof r.id!="string"||!r.id||typeof r.text!="string"||!r.text||r.style!=="text"&&r.style!=="button")return null;const n=Object.freeze(S(m({id:r.id},typeof r.title=="string"?{title:r.title}:{}),{text:r.text,style:r.style})),s=Object.freeze({type:"articleButton",attrs:n});let a=null;if(!t.resolveArticleButtonLink)A(t,{code:"LINK_RESOLUTION_FAILED",path:e,message:"No resolveArticleButtonLink callback was provided for an articleButton node.",nodeType:"articleButton"});else try{const d=t.resolveArticleButtonLink(n,s);a=dt(d),a||A(t,{code:typeof d=="string"||g(d)&&typeof d.href=="string"?"UNSAFE_URL":"LINK_RESOLUTION_FAILED",path:e,message:"The articleButton link resolver returned no usable safe URL.",nodeType:"articleButton"})}catch(d){A(t,{code:"LINK_RESOLUTION_FAILED",path:e,message:`The articleButton link resolver threw an error: ${d instanceof Error?d.message:String(d)}`,nodeType:"articleButton"})}const o=(c=a==null?void 0:a.href)!=null?c:null;return h(t,"a",{class:["acp-article-button",`acp-article-button--${n.style}`,!o&&"acp-article-button--disabled"],href:o!=null?o:void 0,target:a==null?void 0:a.target,rel:a==null?void 0:a.rel,title:n.title,"data-node-type":"articleButton","data-article-button-id":n.id,"data-article-button-style":n.style,"aria-disabled":o?void 0:"true",onClick:d=>{o||d.preventDefault(),t.emitArticleButtonClick({attrs:n,node:s,href:o,event:d})}},n.text)}function M(i,e,t){if(!g(i)||typeof i.type!="string"||!nt.has(i.type))return null;const r=R(i.attrs);switch(i.type){case"paragraph":{const n=q(r.textAlign)?r.textAlign:void 0;return h(t,"p",{class:"acp-paragraph","data-node-type":"paragraph",style:n?{textAlign:n}:void 0},w(i.content,p(e,"content"),t))}case"heading":{const n=Number.isInteger(r.level)&&Number(r.level)>=1&&Number(r.level)<=6?Number(r.level):1,s=q(r.textAlign)?r.textAlign:void 0;return h(t,`h${n}`,{class:["acp-heading",`acp-heading--${n}`],"data-node-type":"heading",style:s?{textAlign:s}:void 0},w(i.content,p(e,"content"),t))}case"blockquote":return h(t,"blockquote",{class:"acp-blockquote","data-node-type":"blockquote"},P(i.content,p(e,"content"),t));case"bulletList":{const n=y(i.content).map((s,a)=>B(s,p(e,"content",a),t)).filter(s=>s!==null);return h(t,"ul",{class:"acp-list acp-list--bullet","data-node-type":"bulletList"},n)}case"orderedList":{const n=Number.isInteger(r.start)&&Number(r.start)>=1?Number(r.start):1,s=y(i.content).map((a,o)=>B(a,p(e,"content",o),t)).filter(a=>a!==null);return h(t,"ol",{class:"acp-list acp-list--ordered","data-node-type":"orderedList",start:n},s)}case"codeBlock":{const n=typeof r.language=="string"&&r.language?r.language:void 0,s=y(i.content).filter(a=>g(a)&&a.type==="text"&&typeof a.text=="string").map(a=>a.text).join("");return h(t,"pre",{class:"acp-code-block","data-node-type":"codeBlock","data-language":n},[h(t,"code",{class:n?`language-${n}`:void 0},s)])}case"horizontalRule":return h(t,"hr",{class:"acp-horizontal-rule","data-node-type":"horizontalRule"});case"image":{const n=E(tt(r.src,t.imageBaseUrl),"image");if(!n)return A(t,{code:"UNSAFE_URL",path:p(e,"attrs","src"),message:"The image URL is empty, malformed, or uses a disallowed protocol.",nodeType:"image"}),null;const s=st(r.imageAlign)?r.imageAlign:"center",a=Number.isInteger(r.width)&&Number(r.width)>=1&&Number(r.width)<=1e4?Number(r.width):void 0,o=Number.isInteger(r.height)&&Number(r.height)>=1&&Number(r.height)<=1e4?Number(r.height):void 0;return h(t,"div",{class:["acp-image",`acp-image--${s}`],"data-node-type":"image","data-image-align":s},[h(t,"img",{class:"acp-image__element",src:n,alt:typeof r.alt=="string"?r.alt:"",title:typeof r.title=="string"?r.title:void 0,width:a,height:o,"data-image-align":s})])}case"articleButton":return ct(i,e,t);case"table":{const n=y(i.content).map((s,a)=>lt(s,p(e,"content",a),t)).filter(s=>s!==null);return h(t,"div",{class:"acp-table-wrapper","data-node-type":"table"},[h(t,"table",{class:"acp-table"},[h(t,"tbody",n)])])}}return null}function P(i,e,t){return y(i).map((r,n)=>M(r,p(e,n),t)).filter(r=>r!==null)}function $(i){return typeof i=="string"||typeof i=="number"?i:void 0}function ut(i,e){const t=$(i.adm),r=$(i.ads),n=t!==void 0&&e.admPublisherId?e.createElement(it,{key:`adm:${i.index}:${String(t)}`,props:{publisherId:e.admPublisherId,slotId:t,title:e.adTitle,fallbackPublisherId:r!==void 0?e.adsPublisherId:void 0,fallbackSlotId:r}}):r!==void 0&&e.adsPublisherId?e.createElement(x,{key:`ads:${i.index}:${String(r)}`,props:{publisherId:e.adsPublisherId,slotId:r,title:e.adTitle}}):null;return e.createElement("div",{key:`/adConf/${i.index}`,staticClass:"acp-ad-slot",attrs:{"data-node-type":"adSlot","data-ad-slot":"true","data-ad-index":i.index,"data-ad-location":i.location,"data-adm":t,"data-ads":r}},n?[n]:[])}function ht(i,e){const t=y(i.content),r=new Map;e.adSlots.forEach(s=>{var o;if(s.location>t.length)return;const a=(o=r.get(s.location))!=null?o:[];a.push(s),r.set(s.location,a)});const n=[];return t.forEach((s,a)=>{var d;const o=a+1;(d=r.get(o))==null||d.forEach(f=>n.push(ut(f,e)));const c=M(s,p("/content",a),e);c&&typeof c!="string"&&n.push(c)}),n}function ft(i,e){return!g(i)||i.type!=="doc"?[]:ht(i,e)}const pt=new Set(["paragraph","heading","blockquote","bulletList","orderedList","codeBlock","horizontalRule","image","articleButton","table"]),gt=new Set(["left","center","right","justify"]),yt=new Set(["left","center","right"]),mt=new Set(["bold","italic","strike","underline","code"]);function b(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function l(i,e){return`${i}/${String(e).replaceAll("~","~0").replaceAll("/","~1")}`}function u(i,...e){let t=i;for(const r of e)t=l(t,r);return t}class bt{constructor(){O(this,"issues",[])}validate(e){if(!b(e))return this.add("INVALID_ROOT","","The document must be an object."),this.result();this.checkProperties(e,"",["type","content"],["type","content"]),e.type!=="doc"&&this.add("INVALID_ROOT","/type",'The root node type must be "doc".');const t=this.requireArray(e.content,"/content");return t==null||t.forEach((r,n)=>this.validateBlock(r,l("/content",n))),this.result()}result(){return{valid:this.issues.length===0,issues:this.issues}}add(e,t,r,n){this.issues.push(m({code:e,path:t,message:r},n?{nodeType:n}:{}))}checkProperties(e,t,r,n=[],s){const a=new Set(r);for(const o of Object.keys(e))a.has(o)||this.add("UNKNOWN_PROPERTY",l(t,o),`Property "${o}" is not allowed.`,s);for(const o of n)o in e||this.add("MISSING_PROPERTY",l(t,o),`Required property "${o}" is missing.`,s)}requireArray(e,t,r){return Array.isArray(e)?e:(this.add("INVALID_TYPE",t,"Expected an array.",r),null)}optionalArray(e,t,r){return e===void 0?[]:this.requireArray(e,t,r)}requireNonEmptyArray(e,t,r){const n=this.requireArray(e,t,r);return n&&n.length===0&&this.add("INVALID_CONTENT",t,`Node "${r}" must contain at least one child.`,r),n}requireRecord(e,t,r){return b(e)?e:(this.add("INVALID_TYPE",t,"Expected an object.",r),null)}optionalRecord(e,t,r){return e===void 0?{}:this.requireRecord(e,t,r)}requireString(e,t,r,n={}){return typeof e!="string"?(this.add("INVALID_TYPE",t,"Expected a string.",r),!1):!n.allowEmpty&&e.length===0?(this.add("INVALID_VALUE",t,"The string must not be empty.",r),!1):n.maxLength!==void 0&&e.length>n.maxLength?(this.add("INVALID_VALUE",t,`The string must contain at most ${n.maxLength} characters.`,r),!1):!0}optionalString(e,t,r,n={}){e!==void 0&&this.requireString(e,t,r,n)}requireInteger(e,t,r,n,s){if(!Number.isInteger(e))return this.add("INVALID_TYPE",t,"Expected an integer.",r),!1;const a=e;return n!==void 0&&a<n?(this.add("INVALID_VALUE",t,`Value must be at least ${n}.`,r),!1):s!==void 0&&a>s?(this.add("INVALID_VALUE",t,`Value must be at most ${s}.`,r),!1):!0}validateBlock(e,t){if(!b(e)){this.add("INVALID_TYPE",t,"A block node must be an object.");return}const r=e.type;if(typeof r!="string"){this.add("MISSING_PROPERTY",l(t,"type"),"A block node requires a type.");return}if(!pt.has(r)){this.add("UNKNOWN_NODE",l(t,"type"),`Unknown block node "${r}".`,r);return}switch(r){case"paragraph":this.validateParagraph(e,t);break;case"heading":this.validateHeading(e,t);break;case"blockquote":this.validateBlockquote(e,t);break;case"bulletList":this.validateBulletList(e,t);break;case"orderedList":this.validateOrderedList(e,t);break;case"codeBlock":this.validateCodeBlock(e,t);break;case"horizontalRule":this.checkProperties(e,t,["type"],["type"],r);break;case"image":this.validateImage(e,t);break;case"articleButton":this.validateArticleButton(e,t);break;case"table":this.validateTable(e,t);break}}validateParagraph(e,t){const r="paragraph";this.checkProperties(e,t,["type","attrs","content"],["type"],r),this.validateTextAlignAttrs(e.attrs,l(t,"attrs"),r,!1),this.validateInlineContent(e.content,l(t,"content"),r)}validateHeading(e,t){const r="heading";this.checkProperties(e,t,["type","attrs","content"],["type","attrs"],r);const n=this.requireRecord(e.attrs,l(t,"attrs"),r);n&&(this.checkProperties(n,l(t,"attrs"),["level","textAlign"],["level"],r),this.requireInteger(n.level,u(t,"attrs","level"),r,1,6),this.validateTextAlign(n.textAlign,u(t,"attrs","textAlign"),r)),this.validateInlineContent(e.content,l(t,"content"),r)}validateTextAlignAttrs(e,t,r,n){const s=n?this.requireRecord(e,t,r):this.optionalRecord(e,t,r);s&&(this.checkProperties(s,t,["textAlign"],[],r),this.validateTextAlign(s.textAlign,l(t,"textAlign"),r))}validateTextAlign(e,t,r){e!==void 0&&(typeof e!="string"?this.add("INVALID_TYPE",t,"Text alignment must be a string.",r):gt.has(e)||this.add("INVALID_VALUE",t,`Unsupported text alignment "${e}".`,r))}validateInlineContent(e,t,r){const n=this.optionalArray(e,t,r);n==null||n.forEach((s,a)=>this.validateText(s,l(t,a),!0))}validateText(e,t,r){if(!b(e)){this.add("INVALID_TYPE",t,"A text node must be an object.","text");return}const n=r?["type","text","marks"]:["type","text"];if(this.checkProperties(e,t,n,["type","text"],"text"),e.type!=="text"&&this.add("INVALID_CONTENT",l(t,"type"),"Expected a text node.","text"),this.requireString(e.text,l(t,"text"),"text"),r&&e.marks!==void 0){const s=this.requireArray(e.marks,l(t,"marks"),"text");s==null||s.forEach((a,o)=>this.validateMark(a,u(t,"marks",o)))}}validateMark(e,t){if(!b(e)){this.add("INVALID_TYPE",t,"A mark must be an object.");return}if(typeof e.type!="string"){this.add("MISSING_PROPERTY",l(t,"type"),"A mark requires a type.");return}if(mt.has(e.type)){this.checkProperties(e,t,["type"],["type"],e.type);return}if(e.type!=="link"){this.add("UNKNOWN_MARK",l(t,"type"),`Unknown mark "${e.type}".`,e.type);return}this.checkProperties(e,t,["type","attrs"],["type","attrs"],"link");const r=this.requireRecord(e.attrs,l(t,"attrs"),"link");r&&(this.checkProperties(r,l(t,"attrs"),["href","target"],["href"],"link"),this.requireString(r.href,u(t,"attrs","href"),"link"),r.target!==void 0&&r.target!=="_blank"&&r.target!=="_self"&&this.add("INVALID_VALUE",u(t,"attrs","target"),'Link target must be "_blank" or "_self".',"link"))}validateBlockquote(e,t){const r="blockquote";this.checkProperties(e,t,["type","content"],["type","content"],r);const n=this.requireNonEmptyArray(e.content,l(t,"content"),r);n==null||n.forEach((s,a)=>this.validateBlock(s,u(t,"content",a)))}validateBulletList(e,t){const r="bulletList";this.checkProperties(e,t,["type","content"],["type","content"],r);const n=this.requireNonEmptyArray(e.content,l(t,"content"),r);n==null||n.forEach((s,a)=>this.validateListItem(s,u(t,"content",a)))}validateOrderedList(e,t){const r="orderedList";this.checkProperties(e,t,["type","attrs","content"],["type","content"],r);const n=this.optionalRecord(e.attrs,l(t,"attrs"),r);n&&(this.checkProperties(n,l(t,"attrs"),["start"],[],r),n.start!==void 0&&this.requireInteger(n.start,u(t,"attrs","start"),r,1));const s=this.requireNonEmptyArray(e.content,l(t,"content"),r);s==null||s.forEach((a,o)=>this.validateListItem(a,u(t,"content",o)))}validateListItem(e,t){const r="listItem",n=this.requireRecord(e,t,r);if(!n)return;this.checkProperties(n,t,["type","content"],["type","content"],r),n.type!==r&&this.add("INVALID_CONTENT",l(t,"type"),"Expected a listItem node.",r);const s=this.requireNonEmptyArray(n.content,l(t,"content"),r);s==null||s.forEach((a,o)=>this.validateBlock(a,u(t,"content",o)))}validateCodeBlock(e,t){const r="codeBlock";this.checkProperties(e,t,["type","attrs","content"],["type"],r);const n=this.optionalRecord(e.attrs,l(t,"attrs"),r);n&&(this.checkProperties(n,l(t,"attrs"),["language"],[],r),this.optionalString(n.language,u(t,"attrs","language"),r,{maxLength:32}));const s=this.optionalArray(e.content,l(t,"content"),r);s&&(s.length>1&&this.add("INVALID_CONTENT",l(t,"content"),"A codeBlock may contain at most one text node.",r),s.forEach((a,o)=>this.validateText(a,u(t,"content",o),!1)))}validateImage(e,t){const r="image";this.checkProperties(e,t,["type","attrs"],["type","attrs"],r);const n=this.requireRecord(e.attrs,l(t,"attrs"),r);n&&(this.checkProperties(n,l(t,"attrs"),["src","alt","title","width","height","imageAlign"],["src"],r),this.requireString(n.src,u(t,"attrs","src"),r),this.optionalString(n.alt,u(t,"attrs","alt"),r,{allowEmpty:!0}),this.optionalString(n.title,u(t,"attrs","title"),r,{allowEmpty:!0}),n.width!==void 0&&this.requireInteger(n.width,u(t,"attrs","width"),r,1,1e4),n.height!==void 0&&this.requireInteger(n.height,u(t,"attrs","height"),r,1,1e4),n.imageAlign!==void 0&&(typeof n.imageAlign!="string"?this.add("INVALID_TYPE",u(t,"attrs","imageAlign"),"Image alignment must be a string.",r):yt.has(n.imageAlign)||this.add("INVALID_VALUE",u(t,"attrs","imageAlign"),`Unsupported image alignment "${n.imageAlign}".`,r)))}validateArticleButton(e,t){const r="articleButton";this.checkProperties(e,t,["type","attrs"],["type","attrs"],r);const n=this.requireRecord(e.attrs,l(t,"attrs"),r);n&&(this.checkProperties(n,l(t,"attrs"),["id","title","text","style"],["id","text","style"],r),this.requireString(n.id,u(t,"attrs","id"),r),this.optionalString(n.title,u(t,"attrs","title"),r),this.requireString(n.text,u(t,"attrs","text"),r),n.style!=="text"&&n.style!=="button"&&this.add("INVALID_VALUE",u(t,"attrs","style"),'Article button style must be "text" or "button".',r))}validateTable(e,t){const r="table";this.checkProperties(e,t,["type","content"],["type","content"],r);const n=this.requireNonEmptyArray(e.content,l(t,"content"),r);if(!n)return;let s=null;n.forEach((a,o)=>{const c=u(t,"content",o),d=this.validateTableRow(a,c);d!==null&&(s===null?s=d:d!==s&&this.add("TABLE_COLUMN_MISMATCH",l(c,"content"),`Expected ${s} table cells but received ${d}.`,"tableRow"))})}validateTableRow(e,t){var a;const r="tableRow",n=this.requireRecord(e,t,r);if(!n)return null;this.checkProperties(n,t,["type","content"],["type","content"],r),n.type!==r&&this.add("INVALID_CONTENT",l(t,"type"),"Expected a tableRow node.",r);const s=this.requireNonEmptyArray(n.content,l(t,"content"),r);return s==null||s.forEach((o,c)=>this.validateTableCell(o,u(t,"content",c))),(a=s==null?void 0:s.length)!=null?a:null}validateTableCell(e,t){const r="tableCell",n=this.requireRecord(e,t,r);if(!n)return;this.checkProperties(n,t,["type","content"],["type","content"],r),n.type!==r&&this.add("INVALID_CONTENT",l(t,"type"),"Expected a tableCell node.",r);const s=this.requireNonEmptyArray(n.content,l(t,"content"),r);s==null||s.forEach((a,o)=>this.validateBlock(a,u(t,"content",o)))}}function At(i){return new bt().validate(i)}const V=Object.freeze({version:1,validate:At,render:ft}),K=new Map([[V.version,V]]),It=Object.freeze([...K.keys()]),T=1;function j(i){return K.get(i)}function z(i,e={}){var s;const t=(s=e.protocolVersion)!=null?s:T,r=j(t);return r?r.validate(i):{valid:!1,issues:[{code:"UNSUPPORTED_PROTOCOL",path:"",message:`Article Content Protocol version ${t} is not supported.`}]}}const kt="Advertisement";function St(){return{adm:[],ads:[],loc:[]}}function Lt(){return{adm:"",ads:""}}function U(i){return`${i.code}:${i.path}:${i.message}`}function Nt(i){var o,c,d,f;const e=(c=(o=i.adm)==null?void 0:o.length)!=null?c:0,t=(f=(d=i.ads)==null?void 0:d.length)!=null?f:0,r=i.loc.length,n=e===0||e===r,s=t===0||t===r,a=e>0||t>0;return r===0&&!a||a&&n&&s?null:{code:"AD_CONFIG_LENGTH_MISMATCH",path:"/adConf",message:`Each non-empty adConf.adm or adConf.ads array must have the same length as adConf.loc, and at least one ad array must contain values when loc is non-empty. Received adm length ${e}, ads length ${t}, and loc length ${r}.`}}function Et(i,e){return e?[]:i.loc.map((t,r)=>{var n,s;return{index:r+1,location:t,adm:(n=i.adm)==null?void 0:n[r],ads:(s=i.ads)==null?void 0:s[r]}}).filter(t=>Number.isInteger(t.location)&&t.location>=1)}const Rt=N.extend({name:"ArticleContentRenderer",props:{document:{type:null,required:!0},protocolVersion:{type:Number,default:T},strict:{type:Boolean,default:!1},adConf:{type:Object,default:St},pubid:{type:Object,default:Lt},adTitle:{type:String,default:kt},imageBaseUrl:{type:String,default:I},resolveArticleButtonLink:{type:Function,default:void 0}},data(){return{reportedRuntimeIssues:new Set,reportedAdConfigIssue:null}},computed:{validation(){return z(this.document,{protocolVersion:this.protocolVersion})},adConfigIssue(){return Nt(this.adConf)},adSlots(){return Et(this.adConf,this.adConfigIssue)}},watch:{validation:{immediate:!0,deep:!0,handler(i){i.issues.forEach(e=>this.$emit("render-error",e))}},document:{deep:!0,handler(){this.reportedRuntimeIssues.clear()}},protocolVersion(){this.reportedRuntimeIssues.clear()},resolveArticleButtonLink(){this.reportedRuntimeIssues.clear()},imageBaseUrl(){this.reportedRuntimeIssues.clear()},adConfigIssue:{immediate:!0,handler(i){if(!i){this.reportedAdConfigIssue=null;return}const e=U(i);this.reportedAdConfigIssue!==e&&(this.reportedAdConfigIssue=e,console.error("[ArticleContentRenderer] Invalid adConf:",i),this.$emit("render-error",i))}}},methods:{reportRuntimeIssue(i){const e=U(i);this.reportedRuntimeIssues.has(e)||(this.reportedRuntimeIssues.add(e),this.$nextTick(()=>this.$emit("render-error",i)))}},render(i){const e=j(this.protocolVersion);if(!e||this.strict&&!this.validation.valid)return i("div",{class:"acp-render-error",attrs:{role:"alert","data-render-error":"true"}},"Invalid article content");const t=e.render(this.document,{createElement:i,adSlots:this.adSlots,admPublisherId:this.pubid.adm,adsPublisherId:this.pubid.ads,adTitle:this.adTitle,imageBaseUrl:this.imageBaseUrl,resolveArticleButtonLink:this.resolveArticleButtonLink,emitArticleButtonClick:r=>this.$emit("article-button-click",r),reportIssue:this.reportRuntimeIssue});return i("div",{class:"acp-document",attrs:{"data-node-type":"doc","data-protocol-version":this.protocolVersion}},t)}});function Pt(i,e,t,r,n,s,a,o){var c=typeof i=="function"?i.options:i;return{exports:i,options:c}}var Tt=Pt(Rt);const _=Tt.exports,_t=Object.freeze({fileFormat:"article-content-protocol",fileFormatVersion:1,mediaType:"application/vnd.article-content-protocol+json",id:"article-content-v1",version:1,name:"Article Content Protocol v1",status:"draft",rootNode:"doc",nodeTypes:Object.freeze(["doc","paragraph","heading","blockquote","bulletList","orderedList","listItem","codeBlock","horizontalRule","image","articleButton","table","tableRow","tableCell","text"]),markTypes:Object.freeze(["bold","italic","strike","underline","code","link"])}),vt={install(i){i.component("ArticleContentRenderer",_)}};exports.ARTICLE_CONTENT_PROTOCOL_V1=_t;exports.ArticleContentRenderer=_;exports.ArticleContentRendererPlugin=vt;exports.CURRENT_PROTOCOL_VERSION=T;exports.SUPPORTED_PROTOCOL_VERSIONS=It;exports.default=_;exports.validateArticleDocument=z;
1
+ "use strict";var j=Object.defineProperty,M=Object.defineProperties;var z=Object.getOwnPropertyDescriptors;var O=Object.getOwnPropertySymbols;var Y=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable;var L=(n,r,t)=>r in n?j(n,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[r]=t,m=(n,r)=>{for(var t in r||(r={}))Y.call(r,t)&&L(n,t,r[t]);if(O)for(var t of O(r))F.call(r,t)&&L(n,t,r[t]);return n},A=(n,r)=>M(n,z(r));var S=(n,r,t)=>L(n,typeof r!="symbol"?r+"":r,t);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const K=require("vue"),G=new Set(["http:","https:","mailto:","tel:"]),W=new Set(["http:","https:","blob:"]),H="https://article-content-renderer.invalid/",I="https://www.doitme.link/";function X(n,r){if(typeof n!="string")return n;const t=n.trim();if(!t.startsWith(I))return t;const i=(r.trim()||I).replace(/\/+$/u,""),s=t.slice(I.length).replace(/^\/+/,"");return`${i}/${s}`}function E(n,r){if(typeof n!="string")return null;const t=n.trim();if(!t||/[\u0000-\u001F\u007F]/u.test(t))return null;try{const e=new URL(t,H);return(r==="link"?G:W).has(e.protocol)?t:null}catch(e){return null}}function q(n,r){const t=new Set(typeof n=="string"?n.trim().split(/\s+/u).filter(Boolean):[]);return r==="_blank"&&(t.add("noopener"),t.add("noreferrer")),t.size>0?[...t].join(" "):void 0}const J=new Set(["paragraph","heading","blockquote","bulletList","orderedList","codeBlock","horizontalRule","image","articleButton","table"]);function h(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function R(n){return h(n)?n:{}}function u(n,r,t,e){var f;const i=h(t)?t:{},s=h(t)?e:t,o={},a={};for(const[l,p]of Object.entries(i))if(l==="class")o.class=p;else if(l==="style")o.style=p;else if(l.startsWith("on")&&typeof p=="function"){const x=l.slice(2).toLowerCase();o.on=A(m({},(f=o.on)!=null?f:{}),{[x]:p})}else p!==void 0&&p!==!1&&(a[l]=p);return Object.keys(a).length>0&&(o.attrs=a),n.createElement(r,o,s)}function y(n){return Array.isArray(n)?n:[]}function g(n,...r){return`${n}/${r.map(String).join("/")}`}function B(n){return n==="left"||n==="center"||n==="right"||n==="justify"}function Q(n){return n==="left"||n==="center"||n==="right"}function N(n){return n==="_blank"||n==="_self"}function b(n,r){n.reportIssue(r)}function Z(n,r,t){if(!h(n)||n.type!=="text"||typeof n.text!="string"||!n.text)return null;let e=n.text;const i=y(n.marks);for(let s=0;s<i.length;s+=1){const o=i[s];if(!h(o)||typeof o.type!="string")continue;const a=g(r,"marks",s);switch(o.type){case"bold":e=u(t,"strong",{class:"acp-mark acp-mark--bold"},[e]);break;case"italic":e=u(t,"em",{class:"acp-mark acp-mark--italic"},[e]);break;case"strike":e=u(t,"s",{class:"acp-mark acp-mark--strike"},[e]);break;case"underline":e=u(t,"u",{class:"acp-mark acp-mark--underline"},[e]);break;case"code":e=u(t,"code",{class:"acp-mark acp-mark--code"},[e]);break;case"link":{const f=R(o.attrs),l=E(f.href,"link");if(!l){b(t,{code:"UNSAFE_URL",path:g(a,"attrs","href"),message:"The link URL is empty, malformed, or uses a disallowed protocol.",nodeType:"link"});break}const p=N(f.target)?f.target:"_blank";e=u(t,"a",{class:"acp-link",href:l,target:p,rel:q(void 0,p)},[e]);break}}}return e}function w(n,r,t){return y(n).map((e,i)=>Z(e,g(r,i),t)).filter(e=>e!==null)}function V(n,r,t){return!h(n)||n.type!=="listItem"?null:u(t,"li",{class:"acp-list-item","data-node-type":"listItem"},T(n.content,g(r,"content"),t))}function tt(n,r,t){return!h(n)||n.type!=="tableCell"?null:u(t,"td",{class:"acp-table-cell","data-node-type":"tableCell"},T(n.content,g(r,"content"),t))}function et(n,r,t){if(!h(n)||n.type!=="tableRow")return null;const e=y(n.content).map((i,s)=>tt(i,g(r,"content",s),t)).filter(i=>i!==null);return u(t,"tr",{class:"acp-table-row","data-node-type":"tableRow"},e)}function rt(n){var i;if(h(n)&&n.target!==void 0&&!N(n.target)||h(n)&&n.rel!==void 0&&typeof n.rel!="string")return null;const r=typeof n=="string"?{href:n}:h(n)&&typeof n.href=="string"?m(m({href:n.href},N(n.target)?{target:n.target}:{}),typeof n.rel=="string"?{rel:n.rel}:{}):null;if(!r)return null;const t=E(r.href,"link");if(!t)return null;const e=(i=r.target)!=null?i:"_self";return{href:t,target:e,rel:q(r.rel,e)}}function nt(n,r,t){var f;const e=R(n.attrs);if(typeof e.id!="string"||!e.id||typeof e.text!="string"||!e.text||e.style!=="text"&&e.style!=="button")return null;const i=Object.freeze(A(m({id:e.id},typeof e.title=="string"?{title:e.title}:{}),{text:e.text,style:e.style})),s=Object.freeze({type:"articleButton",attrs:i});let o=null;if(!t.resolveArticleButtonLink)b(t,{code:"LINK_RESOLUTION_FAILED",path:r,message:"No resolveArticleButtonLink callback was provided for an articleButton node.",nodeType:"articleButton"});else try{const l=t.resolveArticleButtonLink(i,s);o=rt(l),o||b(t,{code:typeof l=="string"||h(l)&&typeof l.href=="string"?"UNSAFE_URL":"LINK_RESOLUTION_FAILED",path:r,message:"The articleButton link resolver returned no usable safe URL.",nodeType:"articleButton"})}catch(l){b(t,{code:"LINK_RESOLUTION_FAILED",path:r,message:`The articleButton link resolver threw an error: ${l instanceof Error?l.message:String(l)}`,nodeType:"articleButton"})}const a=(f=o==null?void 0:o.href)!=null?f:null;return u(t,"a",{class:["acp-article-button",`acp-article-button--${i.style}`,!a&&"acp-article-button--disabled"],href:a!=null?a:void 0,target:o==null?void 0:o.target,rel:o==null?void 0:o.rel,title:i.title,"data-node-type":"articleButton","data-article-button-id":i.id,"data-article-button-style":i.style,"aria-disabled":a?void 0:"true",onClick:l=>{a||l.preventDefault(),t.emitArticleButtonClick({attrs:i,node:s,href:a,event:l})}},i.text)}function U(n,r,t){if(!h(n)||typeof n.type!="string"||!J.has(n.type))return null;const e=R(n.attrs);switch(n.type){case"paragraph":{const i=B(e.textAlign)?e.textAlign:void 0;return u(t,"p",{class:"acp-paragraph","data-node-type":"paragraph",style:i?{textAlign:i}:void 0},w(n.content,g(r,"content"),t))}case"heading":{const i=Number.isInteger(e.level)&&Number(e.level)>=1&&Number(e.level)<=6?Number(e.level):1,s=B(e.textAlign)?e.textAlign:void 0;return u(t,`h${i}`,{class:["acp-heading",`acp-heading--${i}`],"data-node-type":"heading",style:s?{textAlign:s}:void 0},w(n.content,g(r,"content"),t))}case"blockquote":return u(t,"blockquote",{class:"acp-blockquote","data-node-type":"blockquote"},T(n.content,g(r,"content"),t));case"bulletList":{const i=y(n.content).map((s,o)=>V(s,g(r,"content",o),t)).filter(s=>s!==null);return u(t,"ul",{class:"acp-list acp-list--bullet","data-node-type":"bulletList"},i)}case"orderedList":{const i=Number.isInteger(e.start)&&Number(e.start)>=1?Number(e.start):1,s=y(n.content).map((o,a)=>V(o,g(r,"content",a),t)).filter(o=>o!==null);return u(t,"ol",{class:"acp-list acp-list--ordered","data-node-type":"orderedList",start:i},s)}case"codeBlock":{const i=typeof e.language=="string"&&e.language?e.language:void 0,s=y(n.content).filter(o=>h(o)&&o.type==="text"&&typeof o.text=="string").map(o=>o.text).join("");return u(t,"pre",{class:"acp-code-block","data-node-type":"codeBlock","data-language":i},[u(t,"code",{class:i?`language-${i}`:void 0},s)])}case"horizontalRule":return u(t,"hr",{class:"acp-horizontal-rule","data-node-type":"horizontalRule"});case"image":{const i=E(X(e.src,t.imageBaseUrl),"image");if(!i)return b(t,{code:"UNSAFE_URL",path:g(r,"attrs","src"),message:"The image URL is empty, malformed, or uses a disallowed protocol.",nodeType:"image"}),null;const s=Q(e.imageAlign)?e.imageAlign:"center",o=Number.isInteger(e.width)&&Number(e.width)>=1&&Number(e.width)<=1e4?Number(e.width):void 0,a=Number.isInteger(e.height)&&Number(e.height)>=1&&Number(e.height)<=1e4?Number(e.height):void 0;return u(t,"div",{class:["acp-image",`acp-image--${s}`],"data-node-type":"image","data-image-align":s},[u(t,"img",{class:"acp-image__element",src:i,alt:typeof e.alt=="string"?e.alt:"",title:typeof e.title=="string"?e.title:void 0,width:o,height:a,"data-image-align":s})])}case"articleButton":return nt(n,r,t);case"table":{const i=y(n.content).map((s,o)=>et(s,g(r,"content",o),t)).filter(s=>s!==null);return u(t,"div",{class:"acp-table-wrapper","data-node-type":"table"},[u(t,"table",{class:"acp-table"},[u(t,"tbody",i)])])}}return null}function T(n,r,t){return y(n).map((e,i)=>U(e,g(r,i),t)).filter(e=>e!==null)}function it(n,r){const t=y(n.content),e=new Map;r.customSlots.forEach(s=>{var a;if(!Number.isInteger(s.location)||s.location<1||s.location>t.length)return;const o=(a=e.get(s.location))!=null?a:[];o.push(s),e.set(s.location,o)});const i=[];return t.forEach((s,o)=>{var l;const a=o+1;(l=e.get(a))==null||l.forEach(p=>i.push(...p.content));const f=U(s,g("/content",o),r);f&&typeof f!="string"&&i.push(f)}),i}function st(n,r){return!h(n)||n.type!=="doc"?[]:it(n,r)}const ot=new Set(["paragraph","heading","blockquote","bulletList","orderedList","codeBlock","horizontalRule","image","articleButton","table"]),at=new Set(["left","center","right","justify"]),ct=new Set(["left","center","right"]),lt=new Set(["bold","italic","strike","underline","code"]);function k(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function c(n,r){return`${n}/${String(r).replaceAll("~","~0").replaceAll("/","~1")}`}function d(n,...r){let t=n;for(const e of r)t=c(t,e);return t}class dt{constructor(){S(this,"issues",[])}validate(r){if(!k(r))return this.add("INVALID_ROOT","","The document must be an object."),this.result();this.checkProperties(r,"",["type","content"],["type","content"]),r.type!=="doc"&&this.add("INVALID_ROOT","/type",'The root node type must be "doc".');const t=this.requireArray(r.content,"/content");return t==null||t.forEach((e,i)=>this.validateBlock(e,c("/content",i))),this.result()}result(){return{valid:this.issues.length===0,issues:this.issues}}add(r,t,e,i){this.issues.push(m({code:r,path:t,message:e},i?{nodeType:i}:{}))}checkProperties(r,t,e,i=[],s){const o=new Set(e);for(const a of Object.keys(r))o.has(a)||this.add("UNKNOWN_PROPERTY",c(t,a),`Property "${a}" is not allowed.`,s);for(const a of i)a in r||this.add("MISSING_PROPERTY",c(t,a),`Required property "${a}" is missing.`,s)}requireArray(r,t,e){return Array.isArray(r)?r:(this.add("INVALID_TYPE",t,"Expected an array.",e),null)}optionalArray(r,t,e){return r===void 0?[]:this.requireArray(r,t,e)}requireNonEmptyArray(r,t,e){const i=this.requireArray(r,t,e);return i&&i.length===0&&this.add("INVALID_CONTENT",t,`Node "${e}" must contain at least one child.`,e),i}requireRecord(r,t,e){return k(r)?r:(this.add("INVALID_TYPE",t,"Expected an object.",e),null)}optionalRecord(r,t,e){return r===void 0?{}:this.requireRecord(r,t,e)}requireString(r,t,e,i={}){return typeof r!="string"?(this.add("INVALID_TYPE",t,"Expected a string.",e),!1):!i.allowEmpty&&r.length===0?(this.add("INVALID_VALUE",t,"The string must not be empty.",e),!1):i.maxLength!==void 0&&r.length>i.maxLength?(this.add("INVALID_VALUE",t,`The string must contain at most ${i.maxLength} characters.`,e),!1):!0}optionalString(r,t,e,i={}){r!==void 0&&this.requireString(r,t,e,i)}requireInteger(r,t,e,i,s){if(!Number.isInteger(r))return this.add("INVALID_TYPE",t,"Expected an integer.",e),!1;const o=r;return i!==void 0&&o<i?(this.add("INVALID_VALUE",t,`Value must be at least ${i}.`,e),!1):s!==void 0&&o>s?(this.add("INVALID_VALUE",t,`Value must be at most ${s}.`,e),!1):!0}validateBlock(r,t){if(!k(r)){this.add("INVALID_TYPE",t,"A block node must be an object.");return}const e=r.type;if(typeof e!="string"){this.add("MISSING_PROPERTY",c(t,"type"),"A block node requires a type.");return}if(!ot.has(e)){this.add("UNKNOWN_NODE",c(t,"type"),`Unknown block node "${e}".`,e);return}switch(e){case"paragraph":this.validateParagraph(r,t);break;case"heading":this.validateHeading(r,t);break;case"blockquote":this.validateBlockquote(r,t);break;case"bulletList":this.validateBulletList(r,t);break;case"orderedList":this.validateOrderedList(r,t);break;case"codeBlock":this.validateCodeBlock(r,t);break;case"horizontalRule":this.checkProperties(r,t,["type"],["type"],e);break;case"image":this.validateImage(r,t);break;case"articleButton":this.validateArticleButton(r,t);break;case"table":this.validateTable(r,t);break}}validateParagraph(r,t){const e="paragraph";this.checkProperties(r,t,["type","attrs","content"],["type"],e),this.validateTextAlignAttrs(r.attrs,c(t,"attrs"),e,!1),this.validateInlineContent(r.content,c(t,"content"),e)}validateHeading(r,t){const e="heading";this.checkProperties(r,t,["type","attrs","content"],["type","attrs"],e);const i=this.requireRecord(r.attrs,c(t,"attrs"),e);i&&(this.checkProperties(i,c(t,"attrs"),["level","textAlign"],["level"],e),this.requireInteger(i.level,d(t,"attrs","level"),e,1,6),this.validateTextAlign(i.textAlign,d(t,"attrs","textAlign"),e)),this.validateInlineContent(r.content,c(t,"content"),e)}validateTextAlignAttrs(r,t,e,i){const s=i?this.requireRecord(r,t,e):this.optionalRecord(r,t,e);s&&(this.checkProperties(s,t,["textAlign"],[],e),this.validateTextAlign(s.textAlign,c(t,"textAlign"),e))}validateTextAlign(r,t,e){r!==void 0&&(typeof r!="string"?this.add("INVALID_TYPE",t,"Text alignment must be a string.",e):at.has(r)||this.add("INVALID_VALUE",t,`Unsupported text alignment "${r}".`,e))}validateInlineContent(r,t,e){const i=this.optionalArray(r,t,e);i==null||i.forEach((s,o)=>this.validateText(s,c(t,o),!0))}validateText(r,t,e){if(!k(r)){this.add("INVALID_TYPE",t,"A text node must be an object.","text");return}const i=e?["type","text","marks"]:["type","text"];if(this.checkProperties(r,t,i,["type","text"],"text"),r.type!=="text"&&this.add("INVALID_CONTENT",c(t,"type"),"Expected a text node.","text"),this.requireString(r.text,c(t,"text"),"text"),e&&r.marks!==void 0){const s=this.requireArray(r.marks,c(t,"marks"),"text");s==null||s.forEach((o,a)=>this.validateMark(o,d(t,"marks",a)))}}validateMark(r,t){if(!k(r)){this.add("INVALID_TYPE",t,"A mark must be an object.");return}if(typeof r.type!="string"){this.add("MISSING_PROPERTY",c(t,"type"),"A mark requires a type.");return}if(lt.has(r.type)){this.checkProperties(r,t,["type"],["type"],r.type);return}if(r.type!=="link"){this.add("UNKNOWN_MARK",c(t,"type"),`Unknown mark "${r.type}".`,r.type);return}this.checkProperties(r,t,["type","attrs"],["type","attrs"],"link");const e=this.requireRecord(r.attrs,c(t,"attrs"),"link");e&&(this.checkProperties(e,c(t,"attrs"),["href","target"],["href"],"link"),this.requireString(e.href,d(t,"attrs","href"),"link"),e.target!==void 0&&e.target!=="_blank"&&e.target!=="_self"&&this.add("INVALID_VALUE",d(t,"attrs","target"),'Link target must be "_blank" or "_self".',"link"))}validateBlockquote(r,t){const e="blockquote";this.checkProperties(r,t,["type","content"],["type","content"],e);const i=this.requireNonEmptyArray(r.content,c(t,"content"),e);i==null||i.forEach((s,o)=>this.validateBlock(s,d(t,"content",o)))}validateBulletList(r,t){const e="bulletList";this.checkProperties(r,t,["type","content"],["type","content"],e);const i=this.requireNonEmptyArray(r.content,c(t,"content"),e);i==null||i.forEach((s,o)=>this.validateListItem(s,d(t,"content",o)))}validateOrderedList(r,t){const e="orderedList";this.checkProperties(r,t,["type","attrs","content"],["type","content"],e);const i=this.optionalRecord(r.attrs,c(t,"attrs"),e);i&&(this.checkProperties(i,c(t,"attrs"),["start"],[],e),i.start!==void 0&&this.requireInteger(i.start,d(t,"attrs","start"),e,1));const s=this.requireNonEmptyArray(r.content,c(t,"content"),e);s==null||s.forEach((o,a)=>this.validateListItem(o,d(t,"content",a)))}validateListItem(r,t){const e="listItem",i=this.requireRecord(r,t,e);if(!i)return;this.checkProperties(i,t,["type","content"],["type","content"],e),i.type!==e&&this.add("INVALID_CONTENT",c(t,"type"),"Expected a listItem node.",e);const s=this.requireNonEmptyArray(i.content,c(t,"content"),e);s==null||s.forEach((o,a)=>this.validateBlock(o,d(t,"content",a)))}validateCodeBlock(r,t){const e="codeBlock";this.checkProperties(r,t,["type","attrs","content"],["type"],e);const i=this.optionalRecord(r.attrs,c(t,"attrs"),e);i&&(this.checkProperties(i,c(t,"attrs"),["language"],[],e),this.optionalString(i.language,d(t,"attrs","language"),e,{maxLength:32}));const s=this.optionalArray(r.content,c(t,"content"),e);s&&(s.length>1&&this.add("INVALID_CONTENT",c(t,"content"),"A codeBlock may contain at most one text node.",e),s.forEach((o,a)=>this.validateText(o,d(t,"content",a),!1)))}validateImage(r,t){const e="image";this.checkProperties(r,t,["type","attrs"],["type","attrs"],e);const i=this.requireRecord(r.attrs,c(t,"attrs"),e);i&&(this.checkProperties(i,c(t,"attrs"),["src","alt","title","width","height","imageAlign"],["src"],e),this.requireString(i.src,d(t,"attrs","src"),e),this.optionalString(i.alt,d(t,"attrs","alt"),e,{allowEmpty:!0}),this.optionalString(i.title,d(t,"attrs","title"),e,{allowEmpty:!0}),i.width!==void 0&&this.requireInteger(i.width,d(t,"attrs","width"),e,1,1e4),i.height!==void 0&&this.requireInteger(i.height,d(t,"attrs","height"),e,1,1e4),i.imageAlign!==void 0&&(typeof i.imageAlign!="string"?this.add("INVALID_TYPE",d(t,"attrs","imageAlign"),"Image alignment must be a string.",e):ct.has(i.imageAlign)||this.add("INVALID_VALUE",d(t,"attrs","imageAlign"),`Unsupported image alignment "${i.imageAlign}".`,e)))}validateArticleButton(r,t){const e="articleButton";this.checkProperties(r,t,["type","attrs"],["type","attrs"],e);const i=this.requireRecord(r.attrs,c(t,"attrs"),e);i&&(this.checkProperties(i,c(t,"attrs"),["id","title","text","style"],["id","text","style"],e),this.requireString(i.id,d(t,"attrs","id"),e),this.optionalString(i.title,d(t,"attrs","title"),e),this.requireString(i.text,d(t,"attrs","text"),e),i.style!=="text"&&i.style!=="button"&&this.add("INVALID_VALUE",d(t,"attrs","style"),'Article button style must be "text" or "button".',e))}validateTable(r,t){const e="table";this.checkProperties(r,t,["type","content"],["type","content"],e);const i=this.requireNonEmptyArray(r.content,c(t,"content"),e);if(!i)return;let s=null;i.forEach((o,a)=>{const f=d(t,"content",a),l=this.validateTableRow(o,f);l!==null&&(s===null?s=l:l!==s&&this.add("TABLE_COLUMN_MISMATCH",c(f,"content"),`Expected ${s} table cells but received ${l}.`,"tableRow"))})}validateTableRow(r,t){var o;const e="tableRow",i=this.requireRecord(r,t,e);if(!i)return null;this.checkProperties(i,t,["type","content"],["type","content"],e),i.type!==e&&this.add("INVALID_CONTENT",c(t,"type"),"Expected a tableRow node.",e);const s=this.requireNonEmptyArray(i.content,c(t,"content"),e);return s==null||s.forEach((a,f)=>this.validateTableCell(a,d(t,"content",f))),(o=s==null?void 0:s.length)!=null?o:null}validateTableCell(r,t){const e="tableCell",i=this.requireRecord(r,t,e);if(!i)return;this.checkProperties(i,t,["type","content"],["type","content"],e),i.type!==e&&this.add("INVALID_CONTENT",c(t,"type"),"Expected a tableCell node.",e);const s=this.requireNonEmptyArray(i.content,c(t,"content"),e);s==null||s.forEach((o,a)=>this.validateBlock(o,d(t,"content",a)))}}function ut(n){return new dt().validate(n)}const C=Object.freeze({version:1,validate:ut,render:st}),D=new Map([[C.version,C]]),ft=Object.freeze([...D.keys()]),_=1;function v(n){return D.get(n)}function $(n,r={}){var s;const t=(s=r.protocolVersion)!=null?s:_,e=v(t);return e?e.validate(n):{valid:!1,issues:[{code:"UNSUPPORTED_PROTOCOL",path:"",message:`Article Content Protocol version ${t} is not supported.`}]}}function gt(){return[]}function ht(n){return`${n.code}:${n.path}:${n.message}`}const pt=K.extend({name:"ArticleContentRenderer",props:{document:{type:null,required:!0},protocolVersion:{type:Number,default:_},strict:{type:Boolean,default:!1},customSlots:{type:Array,default:gt},imageBaseUrl:{type:String,default:I},resolveArticleButtonLink:{type:Function,default:void 0}},data(){return{reportedRuntimeIssues:new Set}},computed:{validation(){return $(this.document,{protocolVersion:this.protocolVersion})}},watch:{validation:{immediate:!0,deep:!0,handler(n){n.issues.forEach(r=>this.$emit("render-error",r))}},document:{deep:!0,handler(){this.reportedRuntimeIssues.clear()}},protocolVersion(){this.reportedRuntimeIssues.clear()},resolveArticleButtonLink(){this.reportedRuntimeIssues.clear()},imageBaseUrl(){this.reportedRuntimeIssues.clear()}},methods:{resolveCustomSlots(){return this.customSlots.map(n=>{var e,i,s,o;const r={id:n.id,location:n.location},t=(o=(s=(i=(e=this.$scopedSlots)[n.id])==null?void 0:i.call(e,r))!=null?s:this.$slots[n.id])!=null?o:[];return A(m({},n),{content:t})})},reportRuntimeIssue(n){const r=ht(n);this.reportedRuntimeIssues.has(r)||(this.reportedRuntimeIssues.add(r),this.$nextTick(()=>this.$emit("render-error",n)))}},render(n){const r=v(this.protocolVersion);if(!r||this.strict&&!this.validation.valid)return n("div",{class:"acp-render-error",attrs:{role:"alert","data-render-error":"true"}},"Invalid article content");const t=r.render(this.document,{createElement:n,customSlots:this.resolveCustomSlots(),imageBaseUrl:this.imageBaseUrl,resolveArticleButtonLink:this.resolveArticleButtonLink,emitArticleButtonClick:e=>this.$emit("article-button-click",e),reportIssue:this.reportRuntimeIssue});return n("div",{class:"acp-document",attrs:{"data-node-type":"doc","data-protocol-version":this.protocolVersion}},t)}});function yt(n,r,t,e,i,s,o,a){var f=typeof n=="function"?n.options:n;return{exports:n,options:f}}var mt=yt(pt);const P=mt.exports,kt=Object.freeze({fileFormat:"article-content-protocol",fileFormatVersion:1,mediaType:"application/vnd.article-content-protocol+json",id:"article-content-v1",version:1,name:"Article Content Protocol v1",status:"draft",rootNode:"doc",nodeTypes:Object.freeze(["doc","paragraph","heading","blockquote","bulletList","orderedList","listItem","codeBlock","horizontalRule","image","articleButton","table","tableRow","tableCell","text"]),markTypes:Object.freeze(["bold","italic","strike","underline","code","link"])}),bt={install(n){n.component("ArticleContentRenderer",P)}};exports.ARTICLE_CONTENT_PROTOCOL_V1=kt;exports.ArticleContentRenderer=P;exports.ArticleContentRendererPlugin=bt;exports.CURRENT_PROTOCOL_VERSION=_;exports.SUPPORTED_PROTOCOL_VERSIONS=ft;exports.default=P;exports.validateArticleDocument=$;