@lark-apaas/miaoda-coding-sdk 0.0.12 → 0.0.13-alpha.20260909080023
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/design-runtime.dev.js +2 -2
- package/dist/design-runtime.js +2 -2
- package/dist/design-runtime.min.js +1 -1
- package/dist/doubao-runtime.dev.js +151 -72
- package/dist/doubao-runtime.js +151 -72
- package/dist/doubao-runtime.min.js +1 -1
- package/dist/runtime.dev.js +153 -74
- package/dist/runtime.js +153 -74
- package/dist/runtime.min.js +1 -1
- package/package.json +1 -1
|
@@ -519,7 +519,7 @@ var MiaodaRuntime = (() => {
|
|
|
519
519
|
return String(BigInt(msInt) * BigInt(1e6));
|
|
520
520
|
}
|
|
521
521
|
__name(toNanoString, "toNanoString");
|
|
522
|
-
var SDK_VERSION = "1.0.
|
|
522
|
+
var SDK_VERSION = "1.0.2";
|
|
523
523
|
function buildPayload(dataPoints, overrides) {
|
|
524
524
|
const defaultAttrs = getDefaultAttributes(overrides);
|
|
525
525
|
const nowNs = toNanoString(Date.now());
|
|
@@ -761,7 +761,7 @@ var MiaodaRuntime = (() => {
|
|
|
761
761
|
__name(initCreativePvTracking, "initCreativePvTracking");
|
|
762
762
|
|
|
763
763
|
// src/design-runtime.ts
|
|
764
|
-
var version = "0.0.
|
|
764
|
+
var version = "0.0.13-alpha.20260909080023";
|
|
765
765
|
var name = "@lark-apaas/miaoda-coding-sdk";
|
|
766
766
|
if (!window.__CREATIVITY_RUNTIME__) {
|
|
767
767
|
window.__CREATIVITY_RUNTIME__ = true;
|
package/dist/design-runtime.js
CHANGED
|
@@ -519,7 +519,7 @@ var MiaodaRuntime = (() => {
|
|
|
519
519
|
return String(BigInt(msInt) * BigInt(1e6));
|
|
520
520
|
}
|
|
521
521
|
__name(toNanoString, "toNanoString");
|
|
522
|
-
var SDK_VERSION = "1.0.
|
|
522
|
+
var SDK_VERSION = "1.0.2";
|
|
523
523
|
function buildPayload(dataPoints, overrides) {
|
|
524
524
|
const defaultAttrs = getDefaultAttributes(overrides);
|
|
525
525
|
const nowNs = toNanoString(Date.now());
|
|
@@ -761,7 +761,7 @@ var MiaodaRuntime = (() => {
|
|
|
761
761
|
__name(initCreativePvTracking, "initCreativePvTracking");
|
|
762
762
|
|
|
763
763
|
// src/design-runtime.ts
|
|
764
|
-
var version = "0.0.
|
|
764
|
+
var version = "0.0.13-alpha.20260909080023";
|
|
765
765
|
var name = "@lark-apaas/miaoda-coding-sdk";
|
|
766
766
|
if (!window.__CREATIVITY_RUNTIME__) {
|
|
767
767
|
window.__CREATIVITY_RUNTIME__ = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var MiaodaRuntime=(()=>{var y=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var i=(t,e)=>y(t,"name",{value:e,configurable:!0});var H=(t,e)=>{for(var r in e)y(t,r,{get:e[r],enumerable:!0})},K=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of V(e))!j.call(t,o)&&o!==r&&y(t,o,{get:()=>e[o],enumerable:!(n=U(e,o))||n.enumerable});return t};var J=t=>K(y({},"__esModule",{value:!0}),t);var _e={};H(_e,{name:()=>me,version:()=>he});var X=new Set(["text/babel","text/jsx"]),z=3e3,Y=15e3,q=1e3,G=20,P=!1;function A(){P||(P=!0,document.addEventListener("DOMContentLoaded",Q,{once:!0}))}i(A,"initCreativeBabelStages");function Q(){let t=W();if(!t.length)return;let e={fetchDur:0,transformDur:0,evalDur:0,externalCount:t.filter(o=>o.src).length},r={sent:!1,scriptsDone:!1,scriptsDoneAt:null,totalStart:null,renderStart:null,renderDur:null,takeover:!1,retries:0,hardTimer:null},n=window.Babel;if(!n||typeof n.transform!="function"||typeof n.disableScriptTags!="function"||e.externalCount>0&&typeof fetch!="function"){r.scriptsDone=!0,m(e,r);return}try{n.disableScriptTags()}catch{r.scriptsDone=!0,m(e,r);return}r.takeover=!0,r.totalStart=performance.now(),r.hardTimer=setTimeout(()=>m(e,r),Y),te(e,r),ee(n,t,e,r)}i(Q,"onDomContentLoaded");function W(){let t=document.getElementsByTagName("script"),e=[];for(let r=0;r<t.length;r++){let n=t[r];X.has((n.type||"").split(";")[0])&&e.push(n)}return e}i(W,"collectBabelScripts");function T(t,e){let r=t.getAttribute(e);return r===""?[]:r?r.split(",").map(n=>n.trim()):null}i(T,"attrList");function Z(t,e){var o,a,c;let r=t.getAttribute("data-type"),n={browsers:(o=T(t,"data-targets"))!=null?o:void 0};return r==="module"&&(n.esmodules="intersect"),{filename:e,presets:(a=T(t,"data-presets"))!=null?a:r==="module"?["react",["env",{modules:!1}]]:["react","env"],plugins:(c=T(t,"data-plugins"))!=null?c:["transform-class-properties","transform-object-rest-spread","transform-flow-strip-types"],sourceMaps:"inline",sourceFileName:e,targets:n}}i(Z,"buildOptions");function ee(t,e,r,n){let o=0,a=i((l,d)=>{var h;let p;if(l.src)p=l.src;else{let f=l.getAttribute("data-module");f?p=f:(o++,p=o===1?"Inline Babel script":`Inline Babel script (${o})`)}try{let f=performance.now(),g=t.transform(d,Z(l,p)),b=performance.now(),v=document.createElement("script"),w=l.getAttribute("data-type");w&&v.setAttribute("type",w),l.nonce&&(v.nonce=l.nonce),v.text=(h=g==null?void 0:g.code)!=null?h:"",document.head.appendChild(v),r.transformDur+=b-f,r.evalDur+=performance.now()-b}catch(f){console.error("[creative-babel-stages] script failed:",p,f)}},"runOne"),c=0;for(;c<e.length&&!e[c].src;)a(e[c],e[c].innerHTML),c++;if(c>=e.length){D(r,n);return}let u=e.slice(c),s=u.map(l=>{if(!l.src)return Promise.resolve(l.innerHTML);let d=performance.now();return fetch(l.src).then(p=>{if(!p.ok)throw new Error(`HTTP ${p.status}`);return p.text()}).then(p=>(r.fetchDur+=performance.now()-d,p))});(async()=>{for(let l=0;l<u.length;l++){let d=null;try{d=await s[l]}catch(p){console.error("[creative-babel-stages] load failed:",u[l].src,p);continue}a(u[l],d)}D(r,n)})()}i(ee,"runScripts");function te(t,e){let r=window.ReactDOM;if(!r)return;let n=i(c=>{if(e.renderStart===null){e.renderStart=performance.now();try{let u=new MutationObserver(()=>{u.disconnect(),e.renderDur=performance.now()-e.renderStart,e.scriptsDone&&m(t,e)});u.observe(c,{childList:!0,subtree:!0})}catch{}}},"observeCommit"),o=r.createRoot;typeof o=="function"&&(r.createRoot=(c,u)=>{let s=o.call(r,c,u),l=s.render.bind(s);return s.render=d=>(n(c),l(d)),s});let a=r.render;typeof a=="function"&&(r.render=(c,u,s)=>(n(u),a.call(r,c,u,s)))}i(te,"instrumentRender");function D(t,e){e.scriptsDone=!0,e.scriptsDoneAt=performance.now(),e.renderStart===null||e.renderDur!==null?m(t,e):setTimeout(()=>m(t,e),z)}i(D,"onScriptsDone");function m(t,e){var a;if(e.sent)return;let r=window.Slardar;if(!r){e.retries++<G&&setTimeout(()=>m(t,e),q);return}e.sent=!0,e.hardTimer!==null&&clearTimeout(e.hardTimer);let n=e.renderDur!==null&&e.renderStart!==null?e.renderStart+e.renderDur:(a=e.scriptsDoneAt)!=null?a:performance.now(),o=e.totalStart===null?0:Math.max(0,n-e.totalStart);r("sendEvent",{name:"creative_babel_stages",metrics:{babel_total_dur:Math.round(o),babel_fetch_dur:Math.round(t.fetchDur),babel_transform_dur:Math.round(t.transformDur),babel_eval_dur:Math.round(t.evalDur)},categories:{takeover:String(e.takeover),external:String(t.externalCount>0),render_observed:String(e.renderDur!==null)}})}i(m,"trySend");var re="https://lf3-short.ibytedapm.com/slardar/fe/sdk-web/browser.cn.js",R=!1;function M(){if(R)return;if(R=!0,window.Slardar){x();return}let t=document.createElement("script");t.src=re,t.onload=()=>{window.Slardar&&x()},t.onerror=()=>{},document.head.appendChild(t)}i(M,"initCreativePerf");function x(){var o,a,c;let t=window.Slardar;if(!t)return;let e=null;t("context.merge",{app_id:(o=window.__appId__)!=null?o:"",creative_type:(a=window.__creativeType__)!=null?a:"unknown",is_public:String((c=window.__isExternallyVisible__)!=null?c:!1)}),t("init",{bid:"apaas_miaoda",env:window.ENVIRONMENT||"online"}),t("start");try{new PerformanceObserver(u=>{for(let s of u.getEntries())if(s.name==="first-contentful-paint"){e=s.startTime,t("context.merge",{has_painted:"true"});break}}).observe({type:"paint",buffered:!0})}catch{}let r=!1,n=i(()=>{if(r||!window.Slardar)return;r=!0;let u=performance.getEntriesByType("resource"),s=performance.getEntriesByType("navigation")[0],l=e!=null?e:ne(),d={transfer_size:u.reduce((p,h)=>{var f;return p+((f=h.transferSize)!=null?f:0)},0)};s&&s.domContentLoadedEventEnd>=s.responseStart&&(d.ttfb_to_dom_ready_dur=Math.round(s.domContentLoadedEventEnd-s.responseStart)),s&&l!==null&&l>=s.domContentLoadedEventEnd&&(d.render_to_fcp_dur=Math.round(l-s.domContentLoadedEventEnd)),window.Slardar("sendEvent",{name:"creative_perf",metrics:d})},"send");window.addEventListener("load",()=>setTimeout(n,500)),setTimeout(n,15e3)}i(x,"bootstrap");function ne(){var r;let e=performance.getEntriesByType("paint").find(n=>n.name==="first-contentful-paint");return(r=e==null?void 0:e.startTime)!=null?r:null}i(ne,"getBufferedFcpStartTime");function k(){let t="inspector-id";document.addEventListener("DOMContentLoaded",()=>{let e=window.Babel;if(!e||!e.registerPlugin)return;let r=null,n=i(()=>{let a={},c=0;return document.querySelectorAll('script[type="text/babel"],script[type="text/jsx"]').forEach(u=>{let s=u.getAttribute("src");if(s){let l=s.split("?")[0],d=l.split("/").pop()||l;a[d]=d in a?"":l}else{c++;let l=c===1?"Inline Babel script":`Inline Babel script (${c})`;a[l]=u.getAttribute("data-filename")||`inline-${c-1}`}}),a},"buildFileMap");e.availablePlugins&&delete e.availablePlugins[t],e.registerPlugin(t,({types:a})=>({visitor:{JSXOpeningElement(c,u){let s=c.node;if(s.name&&s.name.type==="JSXMemberExpression")return;for(let E=0;E<s.attributes.length;E++){let S=s.attributes[E];if(S.type==="JSXAttribute"&&S.name&&S.name.name==="data-inspector-id")return}let l=u.file&&u.file.opts&&u.file.opts.filename||"?";r===null&&(r=n());let d=l.split("?")[0],p=d.split("/").pop()||d,h=r[l]||r[p]||d.replace(/^\/?[a-z][a-z0-9+.-]*:\/{1,2}[^/]+/i,"").replace(/^\/+/,"")||l,f=s.loc&&s.loc.start,g=f?f.line:0,b=f?f.column+1:0,v=s.name&&s.name.type==="JSXIdentifier"?s.name.name:h,w=`jsx:${h}:${v}:${g}:${b}`;s.attributes.push(a.jsxAttribute(a.jsxIdentifier("data-inspector-id"),a.stringLiteral(w)))}}}));let o="";try{let a=document.getElementById("__srcmap");if(a&&a.textContent){let c=JSON.parse(a.textContent),u=c==null?void 0:c.file;typeof u=="string"&&(o=u)}}catch{}document.querySelectorAll('script[type="text/babel"],script[type="text/jsx"]').forEach((a,c)=>{let u=a.getAttribute("data-plugins")||"";if(u.indexOf(t)<0&&a.setAttribute("data-plugins",u?`${u},${t}`:t),!a.hasAttribute("data-filename")){let s=o?`${o}#inline-${c}`:`inline-${c}`;a.setAttribute("data-filename",a.getAttribute("src")||s)}})})}i(k,"registerInspectorIdPlugin");function C(){if(typeof crypto!="undefined"&&crypto.getRandomValues){let e=new Uint8Array(8);return crypto.getRandomValues(e),Array.from(e).map(r=>r.toString(16).padStart(2,"0")).join("")}let t="";for(let e=0;e<16;e++)t+=Math.floor(Math.random()*16).toString(16);return t}i(C,"generateUUID");var L="x_sdk_device_id";function ie(){try{let t=localStorage.getItem(L);return t||(t=C(),localStorage.setItem(L,t)),t}catch{return C()}}i(ie,"getDeviceId");function oe(){let t=typeof navigator!="undefined"?navigator.userAgent:"";return t&&(/Android/i.test(t)&&/Mobile/i.test(t)||/iPhone|iPod/i.test(t)||/BlackBerry|IEMobile|Opera Mini/i.test(t))?"mobile":"desktop"}i(oe,"getDeviceType");var se="pageSessionID";function ae(){try{return new URLSearchParams(window.location.search).get(se)||""}catch{return""}}i(ae,"getPvId");function ce(t={}){let e=t.pvId||ae();return{app_id:window.appId||"",tenant_id:window.tenantId||"",user_id:window.userId||"",did:ie(),module:"app_web",app_env:"runtime",source_type:"user",device_type:oe(),release_commit_id:window.__RELEASE_COMMIT_ID__||"",...e?{pv_id:e}:{}}}i(ce,"getDefaultAttributes");function N(t){let e=Math.round(t);if(!Number.isFinite(e))throw new RangeError(`toNanoString: \u975E\u6CD5\u65F6\u95F4\u6233 ${t}`);return typeof BigInt!="function"?e===0?"0":`${e}000000`:String(BigInt(e)*BigInt(1e6))}i(N,"toNanoString");var le="1.0.1";function ue(t,e){let r=ce(e),n=N(Date.now());return{metricsData:{resource:{attributes:{sdk_version:le,sdk_lang:"javascript",sdk_type:"client-frontend"}},metrics:[{name:"apaas_internal_metrics_pv_uv",description:"Count of page views",unit:"",scopeName:"apaas_internal_metrics_pv_uv",sum:{aggregationTemporality:1,isMonotonic:!0,dataPoints:t.map(o=>({attributes:{...r,url:o.url,path:o.path,referrer:o.referrer},startTimeUnixNano:N(o.timestampMs),timeUnixNano:n,asDouble:1}))}}]}}}i(ue,"buildPayload");function de(t,e,r={},n){if(e.length===0)return;let o;try{o=JSON.stringify(ue(e,n))}catch{return}try{fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-Suda-Csrf-Token":window.csrfToken||"",...r},body:o,keepalive:!0}).catch(()=>{})}catch{}}i(de,"sendPvData");var I="__APAAS_PV_TRACKER_STARTED__";function pe(){try{let t=window;return t[I]?!1:(t[I]=!0,!0)}catch{return!0}}i(pe,"claimPvReporting");function B(){try{window[I]=!1}catch{}}i(B,"releasePvReporting");var _,fe=(_=class{constructor(){this.started=!1,this.disposers=[],this.holdsPvReporting=!1,this.buffer=[]}static get instance(){return this._instance||(this._instance=new _),this._instance}start(e){var r;if(!this.started&&pe()){this.holdsPvReporting=!0,this.config=e,this.started=!0;try{this.listenRouteChanges(),this.registerLifecycleListeners();let n=(r=e.flushIntervalMs)!=null?r:1e4;this.flushTimer=setInterval(()=>this.flush(),n)}catch(n){throw this.started=!1,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=void 0),this.holdsPvReporting=!1,B(),n}}}shutdown(){this.flush(),this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=void 0),this.firstFlushTimer&&(clearTimeout(this.firstFlushTimer),this.firstFlushTimer=void 0),this.started=!1;for(let e of this.disposers.splice(0))try{e()}catch{}this.holdsPvReporting&&(this.holdsPvReporting=!1,B())}pageKey(){let{origin:e,pathname:r,search:n}=window.location;return`${e}${r}${n}`}scheduleFirstFlush(){var e;let r=(e=this.config)==null?void 0:e.firstFlushDelayMs;r==null||this.firstFlushTimer||(this.firstFlushTimer=setTimeout(()=>this.flush(),r))}recordPv(){let e=this.pageKey();this.lastKey!==e&&(this.lastKey=e,this.buffer.push({url:window.location.href,path:window.location.pathname,referrer:document.referrer,timestampMs:Date.now()}),this.scheduleFirstFlush())}flush(){if(!this.config||this.buffer.length===0)return;let e=this.buffer.splice(0);de(this.config.collectorUrl,e,this.config.headers,{pvId:this.config.pvId})}listenRouteChanges(){this.recordPv();let e=i(()=>this.recordPv(),"onPopState");window.addEventListener("popstate",e),this.disposers.push(()=>window.removeEventListener("popstate",e)),this.patchHistory("pushState"),this.patchHistory("replaceState")}patchHistory(e){let r=history[e],n=i(()=>this.recordPv(),"recordPv");history[e]=function(...o){let a=r.apply(this,o);return n(),a},this.disposers.push(()=>{history[e]=r})}registerLifecycleListeners(){let e=i(()=>{document.visibilityState==="hidden"&&this.flush()},"onVisibilityChange");document.addEventListener("visibilitychange",e),this.disposers.push(()=>document.removeEventListener("visibilitychange",e));let r=i(()=>this.flush(),"onPageHide");window.addEventListener("pagehide",r),this.disposers.push(()=>window.removeEventListener("pagehide",r))}},i(_,"_PvTracker"),_),O=fe.instance;function F(){return window.appId||null}i(F,"getAppId");function $(){var e;let t=(e=F())!=null?e:"";O.start({collectorUrl:`/app/${t}/__runtime__/api/v1/observability/metrics/collect`,firstFlushDelayMs:1e3})}i($,"initCreativePvTracking");var he="0.0.12",me="@lark-apaas/miaoda-coding-sdk";window.__CREATIVITY_RUNTIME__||(window.__CREATIVITY_RUNTIME__=!0,k(),M(),$(),A());return J(_e);})();
|
|
1
|
+
"use strict";var MiaodaRuntime=(()=>{var y=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var i=(t,e)=>y(t,"name",{value:e,configurable:!0});var H=(t,e)=>{for(var r in e)y(t,r,{get:e[r],enumerable:!0})},K=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of V(e))!j.call(t,o)&&o!==r&&y(t,o,{get:()=>e[o],enumerable:!(n=U(e,o))||n.enumerable});return t};var J=t=>K(y({},"__esModule",{value:!0}),t);var _e={};H(_e,{name:()=>me,version:()=>he});var X=new Set(["text/babel","text/jsx"]),z=3e3,Y=15e3,q=1e3,G=20,P=!1;function A(){P||(P=!0,document.addEventListener("DOMContentLoaded",Q,{once:!0}))}i(A,"initCreativeBabelStages");function Q(){let t=W();if(!t.length)return;let e={fetchDur:0,transformDur:0,evalDur:0,externalCount:t.filter(o=>o.src).length},r={sent:!1,scriptsDone:!1,scriptsDoneAt:null,totalStart:null,renderStart:null,renderDur:null,takeover:!1,retries:0,hardTimer:null},n=window.Babel;if(!n||typeof n.transform!="function"||typeof n.disableScriptTags!="function"||e.externalCount>0&&typeof fetch!="function"){r.scriptsDone=!0,m(e,r);return}try{n.disableScriptTags()}catch{r.scriptsDone=!0,m(e,r);return}r.takeover=!0,r.totalStart=performance.now(),r.hardTimer=setTimeout(()=>m(e,r),Y),te(e,r),ee(n,t,e,r)}i(Q,"onDomContentLoaded");function W(){let t=document.getElementsByTagName("script"),e=[];for(let r=0;r<t.length;r++){let n=t[r];X.has((n.type||"").split(";")[0])&&e.push(n)}return e}i(W,"collectBabelScripts");function T(t,e){let r=t.getAttribute(e);return r===""?[]:r?r.split(",").map(n=>n.trim()):null}i(T,"attrList");function Z(t,e){var o,a,c;let r=t.getAttribute("data-type"),n={browsers:(o=T(t,"data-targets"))!=null?o:void 0};return r==="module"&&(n.esmodules="intersect"),{filename:e,presets:(a=T(t,"data-presets"))!=null?a:r==="module"?["react",["env",{modules:!1}]]:["react","env"],plugins:(c=T(t,"data-plugins"))!=null?c:["transform-class-properties","transform-object-rest-spread","transform-flow-strip-types"],sourceMaps:"inline",sourceFileName:e,targets:n}}i(Z,"buildOptions");function ee(t,e,r,n){let o=0,a=i((l,d)=>{var h;let p;if(l.src)p=l.src;else{let f=l.getAttribute("data-module");f?p=f:(o++,p=o===1?"Inline Babel script":`Inline Babel script (${o})`)}try{let f=performance.now(),g=t.transform(d,Z(l,p)),b=performance.now(),v=document.createElement("script"),w=l.getAttribute("data-type");w&&v.setAttribute("type",w),l.nonce&&(v.nonce=l.nonce),v.text=(h=g==null?void 0:g.code)!=null?h:"",document.head.appendChild(v),r.transformDur+=b-f,r.evalDur+=performance.now()-b}catch(f){console.error("[creative-babel-stages] script failed:",p,f)}},"runOne"),c=0;for(;c<e.length&&!e[c].src;)a(e[c],e[c].innerHTML),c++;if(c>=e.length){D(r,n);return}let u=e.slice(c),s=u.map(l=>{if(!l.src)return Promise.resolve(l.innerHTML);let d=performance.now();return fetch(l.src).then(p=>{if(!p.ok)throw new Error(`HTTP ${p.status}`);return p.text()}).then(p=>(r.fetchDur+=performance.now()-d,p))});(async()=>{for(let l=0;l<u.length;l++){let d=null;try{d=await s[l]}catch(p){console.error("[creative-babel-stages] load failed:",u[l].src,p);continue}a(u[l],d)}D(r,n)})()}i(ee,"runScripts");function te(t,e){let r=window.ReactDOM;if(!r)return;let n=i(c=>{if(e.renderStart===null){e.renderStart=performance.now();try{let u=new MutationObserver(()=>{u.disconnect(),e.renderDur=performance.now()-e.renderStart,e.scriptsDone&&m(t,e)});u.observe(c,{childList:!0,subtree:!0})}catch{}}},"observeCommit"),o=r.createRoot;typeof o=="function"&&(r.createRoot=(c,u)=>{let s=o.call(r,c,u),l=s.render.bind(s);return s.render=d=>(n(c),l(d)),s});let a=r.render;typeof a=="function"&&(r.render=(c,u,s)=>(n(u),a.call(r,c,u,s)))}i(te,"instrumentRender");function D(t,e){e.scriptsDone=!0,e.scriptsDoneAt=performance.now(),e.renderStart===null||e.renderDur!==null?m(t,e):setTimeout(()=>m(t,e),z)}i(D,"onScriptsDone");function m(t,e){var a;if(e.sent)return;let r=window.Slardar;if(!r){e.retries++<G&&setTimeout(()=>m(t,e),q);return}e.sent=!0,e.hardTimer!==null&&clearTimeout(e.hardTimer);let n=e.renderDur!==null&&e.renderStart!==null?e.renderStart+e.renderDur:(a=e.scriptsDoneAt)!=null?a:performance.now(),o=e.totalStart===null?0:Math.max(0,n-e.totalStart);r("sendEvent",{name:"creative_babel_stages",metrics:{babel_total_dur:Math.round(o),babel_fetch_dur:Math.round(t.fetchDur),babel_transform_dur:Math.round(t.transformDur),babel_eval_dur:Math.round(t.evalDur)},categories:{takeover:String(e.takeover),external:String(t.externalCount>0),render_observed:String(e.renderDur!==null)}})}i(m,"trySend");var re="https://lf3-short.ibytedapm.com/slardar/fe/sdk-web/browser.cn.js",R=!1;function M(){if(R)return;if(R=!0,window.Slardar){x();return}let t=document.createElement("script");t.src=re,t.onload=()=>{window.Slardar&&x()},t.onerror=()=>{},document.head.appendChild(t)}i(M,"initCreativePerf");function x(){var o,a,c;let t=window.Slardar;if(!t)return;let e=null;t("context.merge",{app_id:(o=window.__appId__)!=null?o:"",creative_type:(a=window.__creativeType__)!=null?a:"unknown",is_public:String((c=window.__isExternallyVisible__)!=null?c:!1)}),t("init",{bid:"apaas_miaoda",env:window.ENVIRONMENT||"online"}),t("start");try{new PerformanceObserver(u=>{for(let s of u.getEntries())if(s.name==="first-contentful-paint"){e=s.startTime,t("context.merge",{has_painted:"true"});break}}).observe({type:"paint",buffered:!0})}catch{}let r=!1,n=i(()=>{if(r||!window.Slardar)return;r=!0;let u=performance.getEntriesByType("resource"),s=performance.getEntriesByType("navigation")[0],l=e!=null?e:ne(),d={transfer_size:u.reduce((p,h)=>{var f;return p+((f=h.transferSize)!=null?f:0)},0)};s&&s.domContentLoadedEventEnd>=s.responseStart&&(d.ttfb_to_dom_ready_dur=Math.round(s.domContentLoadedEventEnd-s.responseStart)),s&&l!==null&&l>=s.domContentLoadedEventEnd&&(d.render_to_fcp_dur=Math.round(l-s.domContentLoadedEventEnd)),window.Slardar("sendEvent",{name:"creative_perf",metrics:d})},"send");window.addEventListener("load",()=>setTimeout(n,500)),setTimeout(n,15e3)}i(x,"bootstrap");function ne(){var r;let e=performance.getEntriesByType("paint").find(n=>n.name==="first-contentful-paint");return(r=e==null?void 0:e.startTime)!=null?r:null}i(ne,"getBufferedFcpStartTime");function k(){let t="inspector-id";document.addEventListener("DOMContentLoaded",()=>{let e=window.Babel;if(!e||!e.registerPlugin)return;let r=null,n=i(()=>{let a={},c=0;return document.querySelectorAll('script[type="text/babel"],script[type="text/jsx"]').forEach(u=>{let s=u.getAttribute("src");if(s){let l=s.split("?")[0],d=l.split("/").pop()||l;a[d]=d in a?"":l}else{c++;let l=c===1?"Inline Babel script":`Inline Babel script (${c})`;a[l]=u.getAttribute("data-filename")||`inline-${c-1}`}}),a},"buildFileMap");e.availablePlugins&&delete e.availablePlugins[t],e.registerPlugin(t,({types:a})=>({visitor:{JSXOpeningElement(c,u){let s=c.node;if(s.name&&s.name.type==="JSXMemberExpression")return;for(let E=0;E<s.attributes.length;E++){let S=s.attributes[E];if(S.type==="JSXAttribute"&&S.name&&S.name.name==="data-inspector-id")return}let l=u.file&&u.file.opts&&u.file.opts.filename||"?";r===null&&(r=n());let d=l.split("?")[0],p=d.split("/").pop()||d,h=r[l]||r[p]||d.replace(/^\/?[a-z][a-z0-9+.-]*:\/{1,2}[^/]+/i,"").replace(/^\/+/,"")||l,f=s.loc&&s.loc.start,g=f?f.line:0,b=f?f.column+1:0,v=s.name&&s.name.type==="JSXIdentifier"?s.name.name:h,w=`jsx:${h}:${v}:${g}:${b}`;s.attributes.push(a.jsxAttribute(a.jsxIdentifier("data-inspector-id"),a.stringLiteral(w)))}}}));let o="";try{let a=document.getElementById("__srcmap");if(a&&a.textContent){let c=JSON.parse(a.textContent),u=c==null?void 0:c.file;typeof u=="string"&&(o=u)}}catch{}document.querySelectorAll('script[type="text/babel"],script[type="text/jsx"]').forEach((a,c)=>{let u=a.getAttribute("data-plugins")||"";if(u.indexOf(t)<0&&a.setAttribute("data-plugins",u?`${u},${t}`:t),!a.hasAttribute("data-filename")){let s=o?`${o}#inline-${c}`:`inline-${c}`;a.setAttribute("data-filename",a.getAttribute("src")||s)}})})}i(k,"registerInspectorIdPlugin");function C(){if(typeof crypto!="undefined"&&crypto.getRandomValues){let e=new Uint8Array(8);return crypto.getRandomValues(e),Array.from(e).map(r=>r.toString(16).padStart(2,"0")).join("")}let t="";for(let e=0;e<16;e++)t+=Math.floor(Math.random()*16).toString(16);return t}i(C,"generateUUID");var L="x_sdk_device_id";function ie(){try{let t=localStorage.getItem(L);return t||(t=C(),localStorage.setItem(L,t)),t}catch{return C()}}i(ie,"getDeviceId");function oe(){let t=typeof navigator!="undefined"?navigator.userAgent:"";return t&&(/Android/i.test(t)&&/Mobile/i.test(t)||/iPhone|iPod/i.test(t)||/BlackBerry|IEMobile|Opera Mini/i.test(t))?"mobile":"desktop"}i(oe,"getDeviceType");var se="pageSessionID";function ae(){try{return new URLSearchParams(window.location.search).get(se)||""}catch{return""}}i(ae,"getPvId");function ce(t={}){let e=t.pvId||ae();return{app_id:window.appId||"",tenant_id:window.tenantId||"",user_id:window.userId||"",did:ie(),module:"app_web",app_env:"runtime",source_type:"user",device_type:oe(),release_commit_id:window.__RELEASE_COMMIT_ID__||"",...e?{pv_id:e}:{}}}i(ce,"getDefaultAttributes");function N(t){let e=Math.round(t);if(!Number.isFinite(e))throw new RangeError(`toNanoString: \u975E\u6CD5\u65F6\u95F4\u6233 ${t}`);return typeof BigInt!="function"?e===0?"0":`${e}000000`:String(BigInt(e)*BigInt(1e6))}i(N,"toNanoString");var le="1.0.2";function ue(t,e){let r=ce(e),n=N(Date.now());return{metricsData:{resource:{attributes:{sdk_version:le,sdk_lang:"javascript",sdk_type:"client-frontend"}},metrics:[{name:"apaas_internal_metrics_pv_uv",description:"Count of page views",unit:"",scopeName:"apaas_internal_metrics_pv_uv",sum:{aggregationTemporality:1,isMonotonic:!0,dataPoints:t.map(o=>({attributes:{...r,url:o.url,path:o.path,referrer:o.referrer},startTimeUnixNano:N(o.timestampMs),timeUnixNano:n,asDouble:1}))}}]}}}i(ue,"buildPayload");function de(t,e,r={},n){if(e.length===0)return;let o;try{o=JSON.stringify(ue(e,n))}catch{return}try{fetch(t,{method:"POST",headers:{"Content-Type":"application/json","X-Suda-Csrf-Token":window.csrfToken||"",...r},body:o,keepalive:!0}).catch(()=>{})}catch{}}i(de,"sendPvData");var I="__APAAS_PV_TRACKER_STARTED__";function pe(){try{let t=window;return t[I]?!1:(t[I]=!0,!0)}catch{return!0}}i(pe,"claimPvReporting");function B(){try{window[I]=!1}catch{}}i(B,"releasePvReporting");var _,fe=(_=class{constructor(){this.started=!1,this.disposers=[],this.holdsPvReporting=!1,this.buffer=[]}static get instance(){return this._instance||(this._instance=new _),this._instance}start(e){var r;if(!this.started&&pe()){this.holdsPvReporting=!0,this.config=e,this.started=!0;try{this.listenRouteChanges(),this.registerLifecycleListeners();let n=(r=e.flushIntervalMs)!=null?r:1e4;this.flushTimer=setInterval(()=>this.flush(),n)}catch(n){throw this.started=!1,this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=void 0),this.holdsPvReporting=!1,B(),n}}}shutdown(){this.flush(),this.flushTimer&&(clearInterval(this.flushTimer),this.flushTimer=void 0),this.firstFlushTimer&&(clearTimeout(this.firstFlushTimer),this.firstFlushTimer=void 0),this.started=!1;for(let e of this.disposers.splice(0))try{e()}catch{}this.holdsPvReporting&&(this.holdsPvReporting=!1,B())}pageKey(){let{origin:e,pathname:r,search:n}=window.location;return`${e}${r}${n}`}scheduleFirstFlush(){var e;let r=(e=this.config)==null?void 0:e.firstFlushDelayMs;r==null||this.firstFlushTimer||(this.firstFlushTimer=setTimeout(()=>this.flush(),r))}recordPv(){let e=this.pageKey();this.lastKey!==e&&(this.lastKey=e,this.buffer.push({url:window.location.href,path:window.location.pathname,referrer:document.referrer,timestampMs:Date.now()}),this.scheduleFirstFlush())}flush(){if(!this.config||this.buffer.length===0)return;let e=this.buffer.splice(0);de(this.config.collectorUrl,e,this.config.headers,{pvId:this.config.pvId})}listenRouteChanges(){this.recordPv();let e=i(()=>this.recordPv(),"onPopState");window.addEventListener("popstate",e),this.disposers.push(()=>window.removeEventListener("popstate",e)),this.patchHistory("pushState"),this.patchHistory("replaceState")}patchHistory(e){let r=history[e],n=i(()=>this.recordPv(),"recordPv");history[e]=function(...o){let a=r.apply(this,o);return n(),a},this.disposers.push(()=>{history[e]=r})}registerLifecycleListeners(){let e=i(()=>{document.visibilityState==="hidden"&&this.flush()},"onVisibilityChange");document.addEventListener("visibilitychange",e),this.disposers.push(()=>document.removeEventListener("visibilitychange",e));let r=i(()=>this.flush(),"onPageHide");window.addEventListener("pagehide",r),this.disposers.push(()=>window.removeEventListener("pagehide",r))}},i(_,"_PvTracker"),_),O=fe.instance;function F(){return window.appId||null}i(F,"getAppId");function $(){var e;let t=(e=F())!=null?e:"";O.start({collectorUrl:`/app/${t}/__runtime__/api/v1/observability/metrics/collect`,firstFlushDelayMs:1e3})}i($,"initCreativePvTracking");var he="0.0.13-alpha.20260909080023",me="@lark-apaas/miaoda-coding-sdk";window.__CREATIVITY_RUNTIME__||(window.__CREATIVITY_RUNTIME__=!0,k(),M(),$(),A());return J(_e);})();
|
|
@@ -1166,7 +1166,7 @@ var MiaodaRuntime = (() => {
|
|
|
1166
1166
|
return String(BigInt(msInt) * BigInt(1e6));
|
|
1167
1167
|
}
|
|
1168
1168
|
__name(toNanoString, "toNanoString");
|
|
1169
|
-
var SDK_VERSION = "1.0.
|
|
1169
|
+
var SDK_VERSION = "1.0.2";
|
|
1170
1170
|
function buildPayload(dataPoints, overrides) {
|
|
1171
1171
|
const defaultAttrs = getDefaultAttributes(overrides);
|
|
1172
1172
|
const nowNs = toNanoString(Date.now());
|
|
@@ -1402,22 +1402,35 @@ var MiaodaRuntime = (() => {
|
|
|
1402
1402
|
__name(initPvTracking, "initPvTracking");
|
|
1403
1403
|
|
|
1404
1404
|
// src/runtime/watermark.ts
|
|
1405
|
-
var CDN = "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp
|
|
1406
|
-
var
|
|
1405
|
+
var CDN = "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp";
|
|
1406
|
+
var DOUBAO_LOGO_SRC = `${CDN}/miaoda-ui/doubao.svg`;
|
|
1407
|
+
var MIAODA_LOGO_SRC = `${CDN}/logo/miaodalogo.svg`;
|
|
1407
1408
|
var CLOSE_ICON_SVG = '<svg viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8.08312 8.08298C8.2384 7.92769 8.23953 7.67705 8.08424 7.52176L5.3625 4.80002L8.08422 2.07829C8.23951 1.92301 8.23839 1.67236 8.0831 1.51708C7.92781 1.36179 7.67717 1.36066 7.52188 1.51595C7.36659 1.67124 4.80016 4.23767 4.80016 4.23767L2.07841 1.51593C1.92313 1.36064 1.67248 1.36177 1.5172 1.51705C1.36191 1.67234 1.36078 1.92298 1.51607 2.07827L4.23782 4.80002L1.51605 7.52178C1.36076 7.67707 1.36189 7.92771 1.51718 8.083C1.67246 8.23829 1.92311 8.23941 2.07839 8.08412L4.80016 5.36236L7.5219 8.0841C7.67719 8.23939 7.92783 8.23826 8.08312 8.08298Z" fill="currentColor"/></svg>';
|
|
1408
1409
|
var FEEDBACK_ICON_SVG = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12.6667 2H3.33333V14H6.66667V15.3334H3.33333C2.59695 15.3334 2 14.7364 2 14V2C2 1.26364 2.59695 0.666687 3.33333 0.666687H12.6667C13.403 0.666687 14 1.26364 14 2V7.33335H12.6667V2Z" fill="currentColor"/><path d="M5.33333 4.66669C4.96514 4.66669 4.66667 4.96516 4.66667 5.33335C4.66667 5.70154 4.96514 6 5.33333 6H10.6667C11.0349 6 11.3333 5.70154 11.3333 5.33335C11.3333 4.96516 11.0349 4.66669 10.6667 4.66669H5.33333Z" fill="currentColor"/><path d="M4.66667 8.33335C4.66667 7.96516 4.96514 7.66669 5.33333 7.66669H8C8.36819 7.66669 8.66667 7.96516 8.66667 8.33335C8.66667 8.70154 8.36819 9 8 9H5.33333C4.96514 9 4.66667 8.70154 4.66667 8.33335Z" fill="currentColor"/><path d="M13.5523 8.70017C13.9428 8.30964 14.576 8.30964 14.9665 8.70017C15.357 9.09069 15.357 9.72386 14.9665 10.1144L14.2594 10.8215L12.8452 9.40728L13.5523 8.70017Z" fill="currentColor"/><path d="M12.1381 10.1144L13.5523 11.5286L10.2309 14.85C10.0916 14.9892 9.91229 15.0815 9.71798 15.1138L8.45737 15.3234C8.42136 15.3294 8.38467 15.3177 8.35885 15.2918C8.33271 15.2657 8.32099 15.2284 8.32749 15.192L8.55128 13.9374C8.58465 13.7502 8.6746 13.5779 8.80901 13.4435L12.1381 10.1144Z" fill="currentColor"/></svg>';
|
|
1410
|
+
var DOWNLOAD_ICON_SVG = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M11.9922 1.99221C12.5445 1.98895 12.9958 2.43407 12.999 2.98634L13.0762 16.1943L14.6387 14.6328L17.8926 11.3789C18.2831 10.9884 18.9171 10.9885 19.3076 11.3789C19.6977 11.7695 19.6979 12.4026 19.3076 12.793L16.0527 16.0479L12.7979 19.3018C12.7111 19.3884 12.6098 19.4566 12.5 19.5059H20.375C20.9271 19.5059 21.3748 19.9538 21.375 20.5059C21.375 21.0581 20.9273 21.5059 20.375 21.5059H3.625C3.07272 21.5059 2.625 21.0581 2.625 20.5059C2.62523 19.9538 3.07286 19.5059 3.625 19.5059H11.6816C11.572 19.4566 11.4704 19.3884 11.3838 19.3018L4.87402 12.793C4.48372 12.4026 4.4839 11.7694 4.87402 11.3789C5.26452 10.9884 5.89756 10.9885 6.28809 11.3789L11.0762 16.166L10.999 2.99806C10.9958 2.44603 11.4402 1.99582 11.9922 1.99221Z" fill="currentColor"/></svg>';
|
|
1411
|
+
var EFFICIENCY_ICON_SVG = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2.0754 7.57153C2.23188 9.44922 3.49231 11.053 5.27982 11.6488C5.31351 11.6601 5.33994 11.6865 5.35117 11.7202L5.72076 12.8289C5.88752 13.3292 6.3557 13.6667 6.88304 13.6667H9.11696C9.6443 13.6667 10.1125 13.3292 10.2792 12.8289L10.6488 11.7202C10.6601 11.6865 10.6865 11.6601 10.7202 11.6488C12.5077 11.053 13.7681 9.44922 13.9246 7.57153L14 6.66667C14 3.35296 11.3137 0.666668 8 0.666668C4.68629 0.666668 2 3.35296 2 6.66667L2.0754 7.57153ZM9.38392 11.2985L9.03899 12.3333H6.96101L6.61608 11.2985C6.47214 10.8667 6.13328 10.5279 5.70146 10.3839C4.41995 9.95675 3.51631 8.80696 3.40413 7.4608L3.33362 6.61462C3.36152 4.06127 5.44004 2 8 2C10.56 2 12.6385 4.06127 12.6664 6.61462L12.5959 7.4608C12.4837 8.80696 11.5801 9.95675 10.2985 10.3839C9.86672 10.5279 9.52786 10.8667 9.38392 11.2985Z" fill="currentColor"/><path d="M6.66667 14.3333C6.29848 14.3333 6 14.6318 6 15C6 15.3682 6.29848 15.6667 6.66667 15.6667H9.33333C9.70152 15.6667 10 15.3682 10 15C10 14.6318 9.70152 14.3333 9.33333 14.3333H6.66667Z" fill="currentColor"/><path d="M8.00864 4.13208L5.44578 6.94049C5.20258 7.18228 5.37835 7.56531 5.74361 7.58951L7.2181 7.6872L7.21814 9.60852C7.21814 9.96788 7.72139 10.1366 7.99168 9.86792C8.26197 9.59921 10.5545 7.05951 10.5545 7.05951C10.7977 6.81772 10.622 6.43469 10.2567 6.41049L8.78222 6.3128L8.78219 4.39148C8.78218 4.03212 8.27893 3.86336 8.00864 4.13208Z" fill="currentColor"/></svg>';
|
|
1409
1412
|
var REPORT_ENABLED = true;
|
|
1410
|
-
var BRAND_TEXT = "\u8C46\u5305 AI \u751F\u6210";
|
|
1411
|
-
var POWERED_BY_TEXT = "\u7531\u98DE\u4E66\u5999\u642D\u63D0\u4F9B\u652F\u6301";
|
|
1412
1413
|
var PILL_SHADOW = "0px 8px 32px rgba(0,0,0,0.08), 0px 4px 16px rgba(0,0,0,0.04), 0px 2px 4px rgba(0,0,0,0.02)";
|
|
1413
1414
|
var CARD_SHADOW = "0px 4px 16px rgba(0,0,0,0.03), 0px 4px 10px rgba(0,0,0,0.03), 0px 2px 4px rgba(0,0,0,0.02)";
|
|
1414
1415
|
var FONT_FAMILY = "'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif";
|
|
1416
|
+
var VARIANT_CONFIG = {
|
|
1417
|
+
doubao: {
|
|
1418
|
+
brandText: "\u8C46\u5305\u5DE5\u4F5C\u751F\u6210",
|
|
1419
|
+
logoSrc: DOUBAO_LOGO_SRC,
|
|
1420
|
+
downloadUrl: "https://ugapk.com/FCtLH"
|
|
1421
|
+
},
|
|
1422
|
+
miaoda: {
|
|
1423
|
+
brandText: "\u5999\u642D\u751F\u6210",
|
|
1424
|
+
logoSrc: MIAODA_LOGO_SRC,
|
|
1425
|
+
landingUrl: "https://miaoda.feishu.cn/landing"
|
|
1426
|
+
}
|
|
1427
|
+
};
|
|
1415
1428
|
var REPORT_DOMAIN = {
|
|
1416
1429
|
BOE: "tns.feishu-boe.cn",
|
|
1417
1430
|
PRE: "tns.feishu-pre.cn",
|
|
1418
1431
|
ONLINE: "tns.feishu.cn"
|
|
1419
1432
|
};
|
|
1420
|
-
function
|
|
1433
|
+
function openReport() {
|
|
1421
1434
|
var _a2;
|
|
1422
1435
|
const params = JSON.stringify({
|
|
1423
1436
|
scene: "miaoda_app_report",
|
|
@@ -1428,7 +1441,13 @@ var MiaodaRuntime = (() => {
|
|
|
1428
1441
|
const url = `https://${REPORT_DOMAIN[getEnv()]}/cust/lark_report/?type=common¶ms=${encodeURIComponent(params)}&lang=zh-CN`;
|
|
1429
1442
|
window.open(url, "_blank", "noopener,noreferrer");
|
|
1430
1443
|
}
|
|
1431
|
-
__name(
|
|
1444
|
+
__name(openReport, "openReport");
|
|
1445
|
+
var ICON_SVG_MAP = {
|
|
1446
|
+
feedback: FEEDBACK_ICON_SVG,
|
|
1447
|
+
close: CLOSE_ICON_SVG,
|
|
1448
|
+
download: DOWNLOAD_ICON_SVG,
|
|
1449
|
+
efficiency: EFFICIENCY_ICON_SVG
|
|
1450
|
+
};
|
|
1432
1451
|
function makeCloseIcon(size) {
|
|
1433
1452
|
const span = document.createElement("span");
|
|
1434
1453
|
Object.assign(span.style, {
|
|
@@ -1447,9 +1466,24 @@ var MiaodaRuntime = (() => {
|
|
|
1447
1466
|
return span;
|
|
1448
1467
|
}
|
|
1449
1468
|
__name(makeCloseIcon, "makeCloseIcon");
|
|
1450
|
-
function
|
|
1469
|
+
function makeIcon(type, size = 16) {
|
|
1470
|
+
if (type === "close") return makeCloseIcon(size);
|
|
1471
|
+
const span = document.createElement("span");
|
|
1472
|
+
Object.assign(span.style, {
|
|
1473
|
+
display: "inline-flex",
|
|
1474
|
+
width: `${size}px`,
|
|
1475
|
+
height: `${size}px`,
|
|
1476
|
+
flexShrink: "0"
|
|
1477
|
+
});
|
|
1478
|
+
span.innerHTML = ICON_SVG_MAP[type];
|
|
1479
|
+
const svg = span.firstElementChild;
|
|
1480
|
+
if (svg) svg.style.display = "block";
|
|
1481
|
+
return span;
|
|
1482
|
+
}
|
|
1483
|
+
__name(makeIcon, "makeIcon");
|
|
1484
|
+
function makeLogo(src, size) {
|
|
1451
1485
|
const img = document.createElement("img");
|
|
1452
|
-
img.src =
|
|
1486
|
+
img.src = src;
|
|
1453
1487
|
img.width = size;
|
|
1454
1488
|
img.height = size;
|
|
1455
1489
|
img.alt = "";
|
|
@@ -1464,25 +1498,26 @@ var MiaodaRuntime = (() => {
|
|
|
1464
1498
|
});
|
|
1465
1499
|
return img;
|
|
1466
1500
|
}
|
|
1467
|
-
__name(
|
|
1468
|
-
function buildPill(variant, onClose) {
|
|
1469
|
-
const isDesktop =
|
|
1501
|
+
__name(makeLogo, "makeLogo");
|
|
1502
|
+
function buildPill(variant, platform, onClose) {
|
|
1503
|
+
const isDesktop = platform === "desktop";
|
|
1504
|
+
const config = VARIANT_CONFIG[variant];
|
|
1470
1505
|
const pill = document.createElement("div");
|
|
1471
1506
|
Object.assign(pill.style, {
|
|
1472
1507
|
boxSizing: "border-box",
|
|
1473
1508
|
display: "inline-flex",
|
|
1474
1509
|
alignItems: "center",
|
|
1475
|
-
gap:
|
|
1476
|
-
padding: isDesktop ? "6px 12px 6px 8px" : "
|
|
1510
|
+
gap: "4px",
|
|
1511
|
+
padding: isDesktop ? "6px 12px 6px 8px" : "5px 12px 5px 8px",
|
|
1477
1512
|
background: "#363636",
|
|
1478
1513
|
border: "0.5px solid rgba(255,255,255,0.1)",
|
|
1479
1514
|
borderRadius: "100px",
|
|
1480
1515
|
boxShadow: PILL_SHADOW,
|
|
1481
1516
|
cursor: "pointer"
|
|
1482
1517
|
});
|
|
1483
|
-
const
|
|
1518
|
+
const logo = makeLogo(config.logoSrc, 16);
|
|
1484
1519
|
const text = document.createElement("span");
|
|
1485
|
-
text.textContent =
|
|
1520
|
+
text.textContent = config.brandText;
|
|
1486
1521
|
Object.assign(text.style, {
|
|
1487
1522
|
fontFamily: FONT_FAMILY,
|
|
1488
1523
|
fontSize: isDesktop ? "12px" : "14px",
|
|
@@ -1490,12 +1525,12 @@ var MiaodaRuntime = (() => {
|
|
|
1490
1525
|
color: "rgba(255,255,255,0.85)",
|
|
1491
1526
|
whiteSpace: "nowrap"
|
|
1492
1527
|
});
|
|
1493
|
-
pill.append(
|
|
1528
|
+
pill.append(logo, text);
|
|
1494
1529
|
if (isDesktop && onClose) {
|
|
1495
1530
|
const close = document.createElement("span");
|
|
1496
1531
|
close.setAttribute("role", "button");
|
|
1497
1532
|
close.setAttribute("aria-label", "\u5173\u95ED");
|
|
1498
|
-
close.setAttribute("data-
|
|
1533
|
+
close.setAttribute("data-watermark-close", "");
|
|
1499
1534
|
Object.assign(close.style, {
|
|
1500
1535
|
display: "none",
|
|
1501
1536
|
alignItems: "center",
|
|
@@ -1522,6 +1557,7 @@ var MiaodaRuntime = (() => {
|
|
|
1522
1557
|
display: "flex",
|
|
1523
1558
|
alignItems: "center",
|
|
1524
1559
|
gap: "8px",
|
|
1560
|
+
minHeight: "38px",
|
|
1525
1561
|
padding: "4px 10px",
|
|
1526
1562
|
borderRadius: "6px",
|
|
1527
1563
|
cursor: "pointer",
|
|
@@ -1535,11 +1571,7 @@ var MiaodaRuntime = (() => {
|
|
|
1535
1571
|
flexShrink: "0",
|
|
1536
1572
|
color: "#000000"
|
|
1537
1573
|
});
|
|
1538
|
-
|
|
1539
|
-
icon.innerHTML = FEEDBACK_ICON_SVG;
|
|
1540
|
-
} else {
|
|
1541
|
-
icon.appendChild(makeCloseIcon(16));
|
|
1542
|
-
}
|
|
1574
|
+
icon.appendChild(makeIcon(opts.icon));
|
|
1543
1575
|
const label = document.createElement("span");
|
|
1544
1576
|
label.textContent = opts.label;
|
|
1545
1577
|
Object.assign(label.style, {
|
|
@@ -1560,7 +1592,18 @@ var MiaodaRuntime = (() => {
|
|
|
1560
1592
|
return row;
|
|
1561
1593
|
}
|
|
1562
1594
|
__name(buildMenuRow, "buildMenuRow");
|
|
1595
|
+
function buildDivider() {
|
|
1596
|
+
const div = document.createElement("div");
|
|
1597
|
+
Object.assign(div.style, {
|
|
1598
|
+
height: "1px",
|
|
1599
|
+
background: "rgba(0,0,0,0.08)",
|
|
1600
|
+
margin: "0 10px"
|
|
1601
|
+
});
|
|
1602
|
+
return div;
|
|
1603
|
+
}
|
|
1604
|
+
__name(buildDivider, "buildDivider");
|
|
1563
1605
|
function buildMenuCard(opts) {
|
|
1606
|
+
var _a2;
|
|
1564
1607
|
const card = document.createElement("div");
|
|
1565
1608
|
Object.assign(card.style, {
|
|
1566
1609
|
boxSizing: "border-box",
|
|
@@ -1574,34 +1617,34 @@ var MiaodaRuntime = (() => {
|
|
|
1574
1617
|
overflow: "hidden",
|
|
1575
1618
|
outline: "none"
|
|
1576
1619
|
});
|
|
1577
|
-
if (opts.
|
|
1578
|
-
const
|
|
1579
|
-
Object.assign(
|
|
1620
|
+
if (opts.items.length) {
|
|
1621
|
+
const section = document.createElement("div");
|
|
1622
|
+
Object.assign(section.style, {
|
|
1623
|
+
boxSizing: "border-box",
|
|
1624
|
+
padding: "4px",
|
|
1625
|
+
display: "flex",
|
|
1626
|
+
flexDirection: "column",
|
|
1627
|
+
gap: `${(_a2 = opts.itemGap) != null ? _a2 : 0}px`
|
|
1628
|
+
});
|
|
1629
|
+
opts.items.forEach((r) => section.appendChild(r));
|
|
1630
|
+
card.appendChild(section);
|
|
1631
|
+
}
|
|
1632
|
+
if (opts.extraItems && opts.extraItems.length) {
|
|
1633
|
+
card.appendChild(buildDivider());
|
|
1634
|
+
const section = document.createElement("div");
|
|
1635
|
+
Object.assign(section.style, {
|
|
1580
1636
|
boxSizing: "border-box",
|
|
1581
1637
|
padding: "4px"
|
|
1582
1638
|
});
|
|
1583
|
-
opts.
|
|
1584
|
-
card.appendChild(
|
|
1639
|
+
opts.extraItems.forEach((r) => section.appendChild(r));
|
|
1640
|
+
card.appendChild(section);
|
|
1585
1641
|
}
|
|
1586
|
-
const footer = document.createElement("div");
|
|
1587
|
-
footer.textContent = POWERED_BY_TEXT;
|
|
1588
|
-
Object.assign(footer.style, {
|
|
1589
|
-
boxSizing: "border-box",
|
|
1590
|
-
background: "#f9f9f9",
|
|
1591
|
-
padding: "8px 14px",
|
|
1592
|
-
fontFamily: FONT_FAMILY,
|
|
1593
|
-
fontSize: `${opts.footerFontSize}px`,
|
|
1594
|
-
lineHeight: `${opts.footerFontSize + 8}px`,
|
|
1595
|
-
color: "rgba(0,0,0,0.35)",
|
|
1596
|
-
whiteSpace: "nowrap"
|
|
1597
|
-
});
|
|
1598
|
-
card.appendChild(footer);
|
|
1599
1642
|
return card;
|
|
1600
1643
|
}
|
|
1601
1644
|
__name(buildMenuCard, "buildMenuCard");
|
|
1602
|
-
function buildDesktopWatermark() {
|
|
1645
|
+
function buildDesktopWatermark(variant) {
|
|
1603
1646
|
const container = document.createElement("div");
|
|
1604
|
-
container.setAttribute("data-custom-element",
|
|
1647
|
+
container.setAttribute("data-custom-element", `${variant}-watermark`);
|
|
1605
1648
|
Object.assign(container.style, {
|
|
1606
1649
|
position: "fixed",
|
|
1607
1650
|
right: "12px",
|
|
@@ -1612,23 +1655,38 @@ var MiaodaRuntime = (() => {
|
|
|
1612
1655
|
alignItems: "flex-end",
|
|
1613
1656
|
gap: "8px"
|
|
1614
1657
|
});
|
|
1615
|
-
const
|
|
1658
|
+
const items = [];
|
|
1659
|
+
if (variant === "doubao") {
|
|
1660
|
+
items.push(buildMenuRow({
|
|
1661
|
+
icon: "download",
|
|
1662
|
+
label: "\u4E0B\u8F7D\u8C46\u5305\u5DE5\u4F5C",
|
|
1663
|
+
fontSize: 14,
|
|
1664
|
+
onClick: /* @__PURE__ */ __name(() => window.open(VARIANT_CONFIG.doubao.downloadUrl, "_blank", "noopener,noreferrer"), "onClick")
|
|
1665
|
+
}));
|
|
1666
|
+
} else {
|
|
1667
|
+
items.push(buildMenuRow({
|
|
1668
|
+
icon: "efficiency",
|
|
1669
|
+
label: "\u4E86\u89E3\u5999\u642D",
|
|
1670
|
+
fontSize: 14,
|
|
1671
|
+
onClick: /* @__PURE__ */ __name(() => window.open(VARIANT_CONFIG.miaoda.landingUrl, "_blank", "noopener,noreferrer"), "onClick")
|
|
1672
|
+
}));
|
|
1673
|
+
}
|
|
1616
1674
|
if (REPORT_ENABLED) {
|
|
1617
|
-
|
|
1675
|
+
items.push(buildMenuRow({
|
|
1618
1676
|
icon: "feedback",
|
|
1619
1677
|
label: "\u6295\u8BC9\u4E0E\u4E3E\u62A5",
|
|
1620
1678
|
fontSize: 14,
|
|
1621
|
-
onClick:
|
|
1679
|
+
onClick: openReport
|
|
1622
1680
|
}));
|
|
1623
1681
|
}
|
|
1624
1682
|
const menu = buildMenuCard({
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1683
|
+
items,
|
|
1684
|
+
minWidth: 160,
|
|
1685
|
+
itemGap: 8
|
|
1628
1686
|
});
|
|
1629
1687
|
menu.style.display = "none";
|
|
1630
|
-
const pill = buildPill("desktop", () => container.remove());
|
|
1631
|
-
const close = pill.querySelector("[data-
|
|
1688
|
+
const pill = buildPill(variant, "desktop", () => container.remove());
|
|
1689
|
+
const close = pill.querySelector("[data-watermark-close]");
|
|
1632
1690
|
container.append(menu, pill);
|
|
1633
1691
|
let timer = null;
|
|
1634
1692
|
container.addEventListener("mouseenter", () => {
|
|
@@ -1645,9 +1703,9 @@ var MiaodaRuntime = (() => {
|
|
|
1645
1703
|
return container;
|
|
1646
1704
|
}
|
|
1647
1705
|
__name(buildDesktopWatermark, "buildDesktopWatermark");
|
|
1648
|
-
function buildMobileWatermark() {
|
|
1706
|
+
function buildMobileWatermark(variant) {
|
|
1649
1707
|
const wrapper = document.createElement("div");
|
|
1650
|
-
wrapper.setAttribute("data-custom-element",
|
|
1708
|
+
wrapper.setAttribute("data-custom-element", `${variant}-watermark-mobile`);
|
|
1651
1709
|
Object.assign(wrapper.style, {
|
|
1652
1710
|
position: "fixed",
|
|
1653
1711
|
right: "12px",
|
|
@@ -1659,31 +1717,48 @@ var MiaodaRuntime = (() => {
|
|
|
1659
1717
|
gap: "8px",
|
|
1660
1718
|
cursor: "pointer"
|
|
1661
1719
|
});
|
|
1662
|
-
const
|
|
1720
|
+
const items = [];
|
|
1721
|
+
if (variant === "doubao") {
|
|
1722
|
+
items.push(buildMenuRow({
|
|
1723
|
+
icon: "download",
|
|
1724
|
+
label: "\u4E0B\u8F7D\u8C46\u5305\u5DE5\u4F5C",
|
|
1725
|
+
fontSize: 16,
|
|
1726
|
+
onClick: /* @__PURE__ */ __name(() => window.open(VARIANT_CONFIG.doubao.downloadUrl, "_blank", "noopener,noreferrer"), "onClick")
|
|
1727
|
+
}));
|
|
1728
|
+
} else {
|
|
1729
|
+
items.push(buildMenuRow({
|
|
1730
|
+
icon: "efficiency",
|
|
1731
|
+
label: "\u4E86\u89E3\u5999\u642D",
|
|
1732
|
+
fontSize: 16,
|
|
1733
|
+
onClick: /* @__PURE__ */ __name(() => window.open(VARIANT_CONFIG.miaoda.landingUrl, "_blank", "noopener,noreferrer"), "onClick")
|
|
1734
|
+
}));
|
|
1735
|
+
}
|
|
1663
1736
|
if (REPORT_ENABLED) {
|
|
1664
|
-
|
|
1737
|
+
items.push(buildMenuRow({
|
|
1665
1738
|
icon: "feedback",
|
|
1666
1739
|
label: "\u6295\u8BC9\u4E0E\u4E3E\u62A5",
|
|
1667
1740
|
fontSize: 16,
|
|
1668
|
-
onClick:
|
|
1741
|
+
onClick: openReport
|
|
1669
1742
|
}));
|
|
1670
1743
|
}
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
e
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1744
|
+
const extraItems = [
|
|
1745
|
+
buildMenuRow({
|
|
1746
|
+
icon: "close",
|
|
1747
|
+
label: "\u4E0D\u518D\u5C55\u793A",
|
|
1748
|
+
fontSize: 16,
|
|
1749
|
+
onClick: /* @__PURE__ */ __name((e) => {
|
|
1750
|
+
e.stopPropagation();
|
|
1751
|
+
wrapper.remove();
|
|
1752
|
+
}, "onClick")
|
|
1753
|
+
})
|
|
1754
|
+
];
|
|
1680
1755
|
const menu = buildMenuCard({
|
|
1681
|
-
|
|
1682
|
-
|
|
1756
|
+
items,
|
|
1757
|
+
extraItems,
|
|
1683
1758
|
minWidth: 160
|
|
1684
1759
|
});
|
|
1685
1760
|
menu.style.display = "none";
|
|
1686
|
-
const pill = buildPill("mobile");
|
|
1761
|
+
const pill = buildPill(variant, "mobile");
|
|
1687
1762
|
wrapper.append(menu, pill);
|
|
1688
1763
|
wrapper.addEventListener("click", (e) => {
|
|
1689
1764
|
e.stopPropagation();
|
|
@@ -1696,22 +1771,26 @@ var MiaodaRuntime = (() => {
|
|
|
1696
1771
|
}
|
|
1697
1772
|
__name(buildMobileWatermark, "buildMobileWatermark");
|
|
1698
1773
|
var mounted = false;
|
|
1699
|
-
function
|
|
1774
|
+
function mountWatermark(variant) {
|
|
1700
1775
|
if (mounted || typeof document === "undefined") return;
|
|
1701
1776
|
if (document.readyState === "loading") {
|
|
1702
|
-
document.addEventListener("DOMContentLoaded",
|
|
1777
|
+
document.addEventListener("DOMContentLoaded", () => mountWatermark(variant), {
|
|
1703
1778
|
once: true
|
|
1704
1779
|
});
|
|
1705
1780
|
return;
|
|
1706
1781
|
}
|
|
1707
1782
|
mounted = true;
|
|
1708
|
-
const el = isMobile() ? buildMobileWatermark() : buildDesktopWatermark();
|
|
1783
|
+
const el = isMobile() ? buildMobileWatermark(variant) : buildDesktopWatermark(variant);
|
|
1709
1784
|
document.body.appendChild(el);
|
|
1710
1785
|
}
|
|
1786
|
+
__name(mountWatermark, "mountWatermark");
|
|
1787
|
+
function mountDoubaoWatermark() {
|
|
1788
|
+
mountWatermark("doubao");
|
|
1789
|
+
}
|
|
1711
1790
|
__name(mountDoubaoWatermark, "mountDoubaoWatermark");
|
|
1712
1791
|
|
|
1713
1792
|
// src/doubao-runtime.ts
|
|
1714
|
-
var version = "0.0.
|
|
1793
|
+
var version = "0.0.13-alpha.20260909080023";
|
|
1715
1794
|
var name = "@lark-apaas/miaoda-coding-sdk";
|
|
1716
1795
|
if (isOnlineEnv()) {
|
|
1717
1796
|
reportPageView();
|