dev-process-kit 0.0.5 → 0.0.6
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 +11 -10
- package/dist/chunks/{shared-C2CXBRPi.js → shared-BF8AzhLw.js} +1 -1
- package/dist/chunks/{shared-C0mdkwlb.js → shared-BN5XrMLt.js} +35 -35
- package/dist/chunks/{shared-Cw5CeV8i.js → shared-BZ71JLz_.js} +3 -3
- package/dist/chunks/{shared-C3elMbSj.js → shared-B_b3KXSe.js} +1 -1
- package/dist/chunks/{shared-BQ0E-JVR.js → shared-Blnsyn6U.js} +5 -5
- package/dist/chunks/{shared-CAGOmktw.js → shared-CbTVavOV.js} +1 -1
- package/dist/chunks/{shared-CdnRdasm.js → shared-D9zBdXMP.js} +1 -1
- package/dist/chunks/{shared-DMl5yToi.js → shared-DI7xrx1a.js} +2 -2
- package/dist/chunks/{shared-CmatZh_d.js → shared-DL7Zn-cH.js} +1 -1
- package/dist/chunks/{shared-BBOnWWgd.js → shared-DSF_A3cy.js} +1 -1
- package/dist/chunks/{shared-ZyeN4ds2.js → shared-Pli_DImS.js} +1 -1
- package/dist/chunks/shared-nn8xc7-Q.js +576 -0
- package/dist/chunks/{shared-HAkNFTDO.js → shared-vUXShHFm.js} +9 -9
- package/dist/components.js +1 -1
- package/dist/index.js +1 -1
- package/dist/templates/delegation-poker.js +1 -0
- package/dist/templates/event-storming.js +1 -1
- package/dist/templates/example-mapping.js +1 -1
- package/dist/templates/grill.js +1 -1
- package/dist/templates/plain.js +1 -1
- package/dist/templates/prototype.js +1 -1
- package/dist/templates/slides.js +1 -1
- package/dist/templates/task-board.js +1 -1
- package/dist/templates/usm.js +1 -1
- package/package.json +3 -2
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const le=globalThis
|
|
2
|
-
\f\r]`,
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
1
|
+
const le=globalThis,Ae=le.ShadowRoot&&(le.ShadyCSS===void 0||le.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ce=Symbol(),lt=new WeakMap;let ct=class{constructor(e,n,s){if(this._$cssResult$=!0,s!==Ce)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=n}get styleSheet(){let e=this.o;const n=this.t;if(Ae&&e===void 0){const s=n!==void 0&&n.length===1;s&&(e=lt.get(n)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&<.set(n,e))}return e}toString(){return this.cssText}};const pt=t=>new ct(typeof t=="string"?t:t+"",void 0,Ce),R=(t,...e)=>{const n=t.length===1?t[0]:e.reduce((s,r,i)=>s+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+t[i+1],t[0]);return new ct(n,t,Ce)},Xn=(t,e)=>{if(Ae)t.adoptedStyleSheets=e.map(n=>n instanceof CSSStyleSheet?n:n.styleSheet);else for(const n of e){const s=document.createElement("style"),r=le.litNonce;r!==void 0&&s.setAttribute("nonce",r),s.textContent=n.cssText,t.appendChild(s)}},ht=Ae?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let n="";for(const s of e.cssRules)n+=s.cssText;return pt(n)})(t):t,{is:es,defineProperty:ts,getOwnPropertyDescriptor:ns,getOwnPropertyNames:ss,getOwnPropertySymbols:rs,getPrototypeOf:is}=Object,ce=globalThis,ut=ce.trustedTypes,os=ut?ut.emptyScript:"",as=ce.reactiveElementPolyfillSupport,Q=(t,e)=>t,Se={toAttribute(t,e){switch(e){case Boolean:t=t?os:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let n=t;switch(e){case Boolean:n=t!==null;break;case Number:n=t===null?null:Number(t);break;case Object:case Array:try{n=JSON.parse(t)}catch{n=null}}return n}},ft=(t,e)=>!es(t,e),gt={attribute:!0,type:String,converter:Se,reflect:!1,useDefault:!1,hasChanged:ft};Symbol.metadata??=Symbol("metadata"),ce.litPropertyMetadata??=new WeakMap;let B=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,n=gt){if(n.state&&(n.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((n=Object.create(n)).wrapped=!0),this.elementProperties.set(e,n),!n.noAccessor){const s=Symbol(),r=this.getPropertyDescriptor(e,s,n);r!==void 0&&ts(this.prototype,e,r)}}static getPropertyDescriptor(e,n,s){const{get:r,set:i}=ns(this.prototype,e)??{get(){return this[n]},set(o){this[n]=o}};return{get:r,set(o){const l=r?.call(this);i?.call(this,o),this.requestUpdate(e,l,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??gt}static _$Ei(){if(this.hasOwnProperty(Q("elementProperties")))return;const e=is(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Q("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Q("properties"))){const n=this.properties,s=[...ss(n),...rs(n)];for(const r of s)this.createProperty(r,n[r])}const e=this[Symbol.metadata];if(e!==null){const n=litPropertyMetadata.get(e);if(n!==void 0)for(const[s,r]of n)this.elementProperties.set(s,r)}this._$Eh=new Map;for(const[n,s]of this.elementProperties){const r=this._$Eu(n,s);r!==void 0&&this._$Eh.set(r,n)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const n=[];if(Array.isArray(e)){const s=new Set(e.flat(1/0).reverse());for(const r of s)n.unshift(ht(r))}else e!==void 0&&n.push(ht(e));return n}static _$Eu(e,n){const s=n.attribute;return s===!1?void 0:typeof s=="string"?s:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,n=this.constructor.elementProperties;for(const s of n.keys())this.hasOwnProperty(s)&&(e.set(s,this[s]),delete this[s]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Xn(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,n,s){this._$AK(e,s)}_$ET(e,n){const s=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,s);if(r!==void 0&&s.reflect===!0){const i=(s.converter?.toAttribute!==void 0?s.converter:Se).toAttribute(n,s.type);this._$Em=e,i==null?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(e,n){const s=this.constructor,r=s._$Eh.get(e);if(r!==void 0&&this._$Em!==r){const i=s.getPropertyOptions(r),o=typeof i.converter=="function"?{fromAttribute:i.converter}:i.converter?.fromAttribute!==void 0?i.converter:Se;this._$Em=r;const l=o.fromAttribute(n,i.type);this[r]=l??this._$Ej?.get(r)??l,this._$Em=null}}requestUpdate(e,n,s,r=!1,i){if(e!==void 0){const o=this.constructor;if(r===!1&&(i=this[e]),s??=o.getPropertyOptions(e),!((s.hasChanged??ft)(i,n)||s.useDefault&&s.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(o._$Eu(e,s))))return;this.C(e,n,s)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,n,{useDefault:s,reflect:r,wrapped:i},o){s&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,o??n??this[e]),i!==!0||o!==void 0)||(this._$AL.has(e)||(this.hasUpdated||s||(n=void 0),this._$AL.set(e,n)),r===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(n){Promise.reject(n)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[r,i]of this._$Ep)this[r]=i;this._$Ep=void 0}const s=this.constructor.elementProperties;if(s.size>0)for(const[r,i]of s){const{wrapped:o}=i,l=this[r];o!==!0||this._$AL.has(r)||l===void 0||this.C(r,void 0,i,l)}}let e=!1;const n=this._$AL;try{e=this.shouldUpdate(n),e?(this.willUpdate(n),this._$EO?.forEach(s=>s.hostUpdate?.()),this.update(n)):this._$EM()}catch(s){throw e=!1,this._$EM(),s}e&&this._$AE(n)}willUpdate(e){}_$AE(e){this._$EO?.forEach(n=>n.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(n=>this._$ET(n,this[n])),this._$EM()}updated(e){}firstUpdated(e){}};B.elementStyles=[],B.shadowRootOptions={mode:"open"},B[Q("elementProperties")]=new Map,B[Q("finalized")]=new Map,as?.({ReactiveElement:B}),(ce.reactiveElementVersions??=[]).push("2.1.2");const _e=globalThis,mt=t=>t,pe=_e.trustedTypes,vt=pe?pe.createPolicy("lit-html",{createHTML:t=>t}):void 0,bt="$lit$",M=`lit$${Math.random().toFixed(9).slice(2)}$`,kt="?"+M,ds=`<${kt}>`,L=document,X=()=>L.createComment(""),ee=t=>t===null||typeof t!="object"&&typeof t!="function",Ee=Array.isArray,ls=t=>Ee(t)||typeof t?.[Symbol.iterator]=="function",Te=`[
|
|
2
|
+
\f\r]`,te=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,yt=/-->/g,xt=/>/g,N=RegExp(`>|${Te}(?:([^\\s"'>=/]+)(${Te}*=${Te}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),wt=/'/g,$t=/"/g,At=/^(?:script|style|textarea|title)$/i,Ct=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),f=Ct(1),cs=Ct(2),P=Symbol.for("lit-noChange"),m=Symbol.for("lit-nothing"),St=new WeakMap,D=L.createTreeWalker(L,129);function _t(t,e){if(!Ee(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return vt!==void 0?vt.createHTML(e):e}const ps=(t,e)=>{const n=t.length-1,s=[];let r,i=e===2?"<svg>":e===3?"<math>":"",o=te;for(let l=0;l<n;l++){const a=t[l];let d,p,c=-1,h=0;for(;h<a.length&&(o.lastIndex=h,p=o.exec(a),p!==null);)h=o.lastIndex,o===te?p[1]==="!--"?o=yt:p[1]!==void 0?o=xt:p[2]!==void 0?(At.test(p[2])&&(r=RegExp("</"+p[2],"g")),o=N):p[3]!==void 0&&(o=N):o===N?p[0]===">"?(o=r??te,c=-1):p[1]===void 0?c=-2:(c=o.lastIndex-p[2].length,d=p[1],o=p[3]===void 0?N:p[3]==='"'?$t:wt):o===$t||o===wt?o=N:o===yt||o===xt?o=te:(o=N,r=void 0);const u=o===N&&t[l+1].startsWith("/>")?" ":"";i+=o===te?a+ds:c>=0?(s.push(d),a.slice(0,c)+bt+a.slice(c)+M+u):a+M+(c===-2?l:u)}return[_t(t,i+(t[n]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),s]};class de{constructor({strings:e,_$litType$:n},s){let r;this.parts=[];let i=0,o=0;const l=e.length-1,a=this.parts,[d,p]=ps(e,n);if(this.el=de.createElement(d,s),D.currentNode=this.el.content,n===2||n===3){const c=this.el.content.firstChild;c.replaceWith(...c.childNodes)}for(;(r=D.nextNode())!==null&&a.length<l;){if(r.nodeType===1){if(r.hasAttributes())for(const c of r.getAttributeNames())if(c.endsWith(bt)){const h=p[o++],u=r.getAttribute(c).split(M),v=/([.?@])?(.*)/.exec(h);a.push({type:1,index:i,name:v[2],strings:u,ctor:v[1]==="."?us:v[1]==="?"?fs:v[1]==="@"?gs:he}),r.removeAttribute(c)}else c.startsWith(M)&&(a.push({type:6,index:i}),r.removeAttribute(c));if(At.test(r.tagName)){const c=r.textContent.split(M),h=c.length-1;if(h>0){r.textContent=pe?pe.emptyScript:"";for(let u=0;u<h;u++)r.append(c[u],X()),D.nextNode(),a.push({type:2,index:++i});r.append(c[h],X())}}}else if(r.nodeType===8)if(r.data===kt)a.push({type:2,index:i});else{let c=-1;for(;(c=r.data.indexOf(M,c+1))!==-1;)a.push({type:7,index:i}),c+=M.length-1}i++}}static createElement(e,n){const s=L.createElement("template");return s.innerHTML=e,s}}function H(t,e,n=t,s){if(e===P)return e;let r=s!==void 0?n._$Co?.[s]:n._$Cl;const i=ee(e)?void 0:e._$litDirective$;return r?.constructor!==i&&(r?._$AO?.(!1),i===void 0?r=void 0:(r=new i(t),r._$AT(t,n,s)),s!==void 0?(n._$Co??=[])[s]=r:n._$Cl=r),r!==void 0&&(e=H(t,r._$AS(t,e.values),r,s)),e}class hs{constructor(e,n){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:n},parts:s}=this._$AD,r=(e?.creationScope??L).importNode(n,!0);D.currentNode=r;let i=D.nextNode(),o=0,l=0,a=s[0];for(;a!==void 0;){if(o===a.index){let d;a.type===2?d=new Z(i,i.nextSibling,this,e):a.type===1?d=new a.ctor(i,a.name,a.strings,this,e):a.type===6&&(d=new ms(i,this,e)),this._$AV.push(d),a=s[++l]}o!==a?.index&&(i=D.nextNode(),o++)}return D.currentNode=L,r}p(e){let n=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(e,s,n),n+=s.strings.length-2):s._$AI(e[n])),n++}}class Z{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,n,s,r){this.type=2,this._$AH=m,this._$AN=void 0,this._$AA=e,this._$AB=n,this._$AM=s,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const n=this._$AM;return n!==void 0&&e?.nodeType===11&&(e=n.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,n=this){e=H(this,e,n),ee(e)?e===m||e==null||e===""?(this._$AH!==m&&this._$AR(),this._$AH=m):e!==this._$AH&&e!==P&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):ls(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==m&&ee(this._$AH)?this._$AA.nextSibling.data=e:this.T(L.createTextNode(e)),this._$AH=e}$(e){const{values:n,_$litType$:s}=e,r=typeof s=="number"?this._$AC(e):(s.el===void 0&&(s.el=de.createElement(_t(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===r)this._$AH.p(n);else{const i=new hs(r,this),o=i.u(this.options);i.p(n),this.T(o),this._$AH=i}}_$AC(e){let n=St.get(e.strings);return n===void 0&&St.set(e.strings,n=new de(e)),n}k(e){Ee(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let s,r=0;for(const i of e)r===n.length?n.push(s=new Z(this.O(X()),this.O(X()),this,this.options)):s=n[r],s._$AI(i),r++;r<n.length&&(this._$AR(s&&s._$AB.nextSibling,r),n.length=r)}_$AR(e=this._$AA.nextSibling,n){for(this._$AP?.(!1,!0,n);e!==this._$AB;){const s=mt(e).nextSibling;mt(e).remove(),e=s}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}}class he{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,n,s,r,i){this.type=1,this._$AH=m,this._$AN=void 0,this.element=e,this.name=n,this._$AM=r,this.options=i,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=m}_$AI(e,n=this,s,r){const i=this.strings;let o=!1;if(i===void 0)e=H(this,e,n,0),o=!ee(e)||e!==this._$AH&&e!==P,o&&(this._$AH=e);else{const l=e;let a,d;for(e=i[0],a=0;a<i.length-1;a++)d=H(this,l[s+a],n,a),d===P&&(d=this._$AH[a]),o||=!ee(d)||d!==this._$AH[a],d===m?e=m:e!==m&&(e+=(d??"")+i[a+1]),this._$AH[a]=d}o&&!r&&this.j(e)}j(e){e===m?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class us extends he{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===m?void 0:e}}class fs extends he{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==m)}}class gs extends he{constructor(e,n,s,r,i){super(e,n,s,r,i),this.type=5}_$AI(e,n=this){if((e=H(this,e,n,0)??m)===P)return;const s=this._$AH,r=e===m&&s!==m||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,i=e!==m&&(s===m||r);r&&this.element.removeEventListener(this.name,this,s),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class ms{constructor(e,n,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=n,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){H(this,e)}}const vs={I:Z},bs=_e.litHtmlPolyfillSupport;bs?.(de,Z),(_e.litHtmlVersions??=[]).push("3.3.3");const ks=(t,e,n)=>{const s=n?.renderBefore??e;let r=s._$litPart$;if(r===void 0){const i=n?.renderBefore??null;s._$litPart$=r=new Z(e.insertBefore(X(),i),i,void 0,n??{})}return r._$AI(t),r},Me=globalThis;let O=class extends B{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const n=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=ks(n,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return P}};O._$litElement$=!0,O.finalized=!0,Me.litElementHydrateSupport?.({LitElement:O});const ys=Me.litElementPolyfillSupport;ys?.({LitElement:O}),(Me.litElementVersions??=[]).push("4.2.2");const Oe=t=>{let e=t;for(;e!==null;){if(e instanceof Element){const n=e.getAttribute("lang");if(n!==null)return n}e=e instanceof ShadowRoot?e.host:e.parentNode}return null},je=["en","ja"],Et="en",Tt=t=>je.some(e=>e===t),Re=t=>{const e=(t??"").split("-")[0]?.toLowerCase()??"";return Tt(e)?e:Et},Mt=t=>Re(Oe(t)),Le="dpk-locale-change",Ot=t=>typeof t=="string"&&Tt(t)?t:null,xs=t=>t.preference??t.authored,ws=(t,e)=>t===e?null:t,ue=t=>e=>e==="ja"?t.ja:t.en;class Ne{#e;#r;#s=Et;constructor(e,n=()=>{}){this.#e=e,this.#r=n,e.addController(this)}get locale(){return this.#s}hostConnected(){this.#s=Mt(this.#e),document.addEventListener(Le,this.#t)}hostDisconnected(){document.removeEventListener(Le,this.#t)}#t=()=>{const e=Mt(this.#e);e!==this.#s&&(this.#s=e,this.#r(),this.#e.requestUpdate())}}const $s={paper:["#f6f7f9","#0e1014"],"paper-raised":["#ffffff","#171a20"],"paper-sunken":["#eff1f4","#0a0b0e"],"paper-inset":["#e7eaef","#22262e"],ink:["#11141b","#eceef3"],"ink-soft":["#464e5f","#a9b0bd"],"ink-faint":["#788195","#737b8b"],rule:["rgba(17, 24, 39, 0.08)","rgba(226, 232, 244, 0.08)"],"rule-strong":["rgba(17, 24, 39, 0.13)","rgba(226, 232, 244, 0.14)"],"rule-hover":["rgba(17, 24, 39, 0.24)","rgba(226, 232, 244, 0.26)"],accent:["#e04e1f","#f26a3d"],"accent-strong":["#c63f12","#dc5226"],"accent-bright":["#f0652f","#ff8a5e"],"accent-soft":["rgba(224, 78, 31, 0.08)","rgba(242, 106, 61, 0.14)"],"accent-ink":["#ffffff","#ffffff"],blue:["#3563d9","#7aa2f7"],"blue-strong":["#2a4fb3","#5b86e8"],"blue-soft":["rgba(53, 99, 217, 0.09)","rgba(122, 162, 247, 0.15)"],green:["#15894a","#4cc787"],"green-soft":["rgba(21, 137, 74, 0.09)","rgba(76, 199, 135, 0.14)"],amber:["#b27406","#e9ae45"],"amber-soft":["rgba(178, 116, 6, 0.1)","rgba(233, 174, 69, 0.15)"],violet:["#7549d6","#ab90f5"],"violet-soft":["rgba(117, 73, 214, 0.09)","rgba(171, 144, 245, 0.15)"],danger:["#c11d38","#f5707f"],"danger-soft":["rgba(214, 53, 80, 0.09)","rgba(245, 112, 127, 0.14)"],shade:["rgb(17, 24, 39)","rgb(0, 0, 0)"],"shade-1":["rgba(17, 24, 39, 0.06)","rgba(0, 0, 0, 0.32)"],"shade-2":["rgba(17, 24, 39, 0.08)","rgba(0, 0, 0, 0.38)"],"shade-3":["rgba(17, 24, 39, 0.13)","rgba(0, 0, 0, 0.5)"],highlight:["rgba(255, 255, 255, 0.9)","rgba(255, 255, 255, 0.05)"]},jt=t=>pt(Object.entries($s).map(([e,[n,s]])=>`--dpk-${e}: ${t(n,s)};`).join(`
|
|
4
4
|
`)),fe=R`
|
|
5
5
|
:host {
|
|
6
6
|
/* Browsers without light-dark() stay light. */
|
|
7
|
-
${
|
|
7
|
+
${jt(t=>t)}
|
|
8
8
|
--dpk-display: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
9
9
|
--dpk-body: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
10
10
|
--dpk-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
|
|
@@ -42,7 +42,7 @@ const le=globalThis,$e=le.ShadowRoot&&(le.ShadyCSS===void 0||le.ShadyCSS.nativeS
|
|
|
42
42
|
|
|
43
43
|
@supports (color: light-dark(#000, #fff)) {
|
|
44
44
|
:host {
|
|
45
|
-
${
|
|
45
|
+
${jt((t,e)=>`light-dark(${t}, ${e})`)}
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
|
@@ -383,7 +383,7 @@ const le=globalThis,$e=le.ShadowRoot&&(le.ShadyCSS===void 0||le.ShadyCSS.nativeS
|
|
|
383
383
|
align-items: center;
|
|
384
384
|
justify-content: flex-end;
|
|
385
385
|
}
|
|
386
|
-
`,
|
|
386
|
+
`,F=(t,e)=>t instanceof e?t:null,Cs=ue({en:{clickToEdit:"Click to edit",unset:"Not set",edit:"Edit"},ja:{clickToEdit:"\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u7DE8\u96C6",unset:"\u672A\u8A2D\u5B9A",edit:"\u7DE8\u96C6"}});class Rt extends O{static{this.styles=[fe,ge,R`
|
|
387
387
|
:host {
|
|
388
388
|
display: inline;
|
|
389
389
|
/* Inherit the surrounding type scale instead of forcing the chrome size:
|
|
@@ -483,7 +483,7 @@ const le=globalThis,$e=le.ShadowRoot&&(le.ShadyCSS===void 0||le.ShadyCSS.nativeS
|
|
|
483
483
|
:host([seamless]) .view {
|
|
484
484
|
padding: 0;
|
|
485
485
|
}
|
|
486
|
-
`]}static{this.properties={value:{type:String},placeholder:{type:String},multiline:{type:Boolean},wrap:{type:Boolean,reflect:!0},seamless:{type:Boolean,reflect:!0},label:{type:String},editing:{state:!0}}}#e="";#r=0;#s=new
|
|
486
|
+
`]}static{this.properties={value:{type:String},placeholder:{type:String},multiline:{type:Boolean},wrap:{type:Boolean,reflect:!0},seamless:{type:Boolean,reflect:!0},label:{type:String},editing:{state:!0}}}#e="";#r=0;#s=new Ne(this);connectedCallback(){super.connectedCallback(),this.#r+=1}constructor(){super(),this.value="",this.placeholder="",this.multiline=!1,this.wrap=!1,this.seamless=!1,this.label="",this.editing=!1,this.#e=""}startEditing(){this.#e=this.value,this.editing=!0}willUpdate(e){e.has("value")&&!this.editing&&(this.#e=this.value)}updated(){if(!this.editing)return;const e=this.renderRoot.querySelector("input, textarea"),n=this.renderRoot,s=n instanceof ShadowRoot?n.activeElement:document.activeElement;e&&s!==e&&(e.focus(),e.select())}render(){const e=Cs(this.#s.locale);if(!this.editing){const s=this.value.length===0;return f`<span
|
|
487
487
|
class="view"
|
|
488
488
|
data-empty=${String(s)}
|
|
489
489
|
role="button"
|
|
@@ -508,18 +508,18 @@ const le=globalThis,$e=le.ShadowRoot&&(le.ShadyCSS===void 0||le.ShadyCSS.nativeS
|
|
|
508
508
|
@keydown=${this.#o}
|
|
509
509
|
@blur=${this.#a}
|
|
510
510
|
/>`}
|
|
511
|
-
`}#t=e=>{e.stopPropagation(),this.editing=!0};#i=e=>{e.isComposing||(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.editing=!0)};#n=e=>{const n=te(e.target,HTMLInputElement)??te(e.target,HTMLTextAreaElement);n!==null&&(this.#e=n.value)};#o=e=>{if(!e.isComposing){if(e.key==="Escape"){e.preventDefault(),this.#e=this.value,this.editing=!1;return}e.key==="Enter"&&(!this.multiline||this.wrap||e.metaKey||e.ctrlKey)&&(e.preventDefault(),this.#d())}};#a=e=>{const n=e.currentTarget;if(!(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement))return;const s=this.#r,{selectionStart:r,selectionEnd:i}=n;queueMicrotask(()=>{!this.isConnected||!this.editing||(s!==this.#r?(n.focus(),n.setSelectionRange(r,i)):this.#d())})};#d=()=>{if(!this.editing)return;this.editing=!1;const n=(this.wrap?this.#e.replace(/\r?\n/g," "):this.#e).trim();n!==this.value&&this.dispatchEvent(new CustomEvent("dpk-commit",{detail:{value:n},bubbles:!0,composed:!0}))}}const Ss=()=>{customElements.get("dpk-component-inline-edit")||customElements.define("dpk-component-inline-edit",jt)},_s={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0};function Ne(t){return _s}let Es;function Ts(t){return Es?.get(t)}let Ms;function Os(t){return Ms?.get(t)}let js;function Rs(t,e){return js?.get(t)?.get(e)}function ne(t){const e=typeof t;return e==="string"?`"${t}"`:e==="number"||e==="bigint"||e==="boolean"?`${t}`:e==="object"||e==="function"?(t&&Object.getPrototypeOf(t)?.constructor?.name)??"null":e}function x(t,e,n,s,r){const i=r&&"input"in r?r.input:n.value,o=r?.expected??t.expects??null,l=r?.received??ne(i),a={kind:t.kind,type:t.type,input:i,expected:o,received:l,message:`Invalid ${e}: ${o?`Expected ${o} but r`:"R"}eceived ${l}`,requirement:t.requirement,path:r?.path,issues:r?.issues,lang:s.lang,abortEarly:s.abortEarly,abortPipeEarly:s.abortPipeEarly},d=t.kind==="schema",p=r?.message??t.message??Rs(t.reference,a.lang)??(d?Os(a.lang):null)??s.message??Ts(a.lang);p!==void 0&&(a.message=typeof p=="function"?p(a):p),d&&(n.typed=!1),n.issues?n.issues.push(a):n.issues=[a]}function Ls(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}function Ns(t,e){return Object.prototype.hasOwnProperty.call(t,e)&&e!=="__proto__"&&e!=="prototype"&&e!=="constructor"}function Pe(t,e){const n=[...new Set(t)];return n.length>1?`(${n.join(` ${e} `)})`:n[0]??"never"}function w(t){return t["~standard"]={version:1,vendor:"valibot",validate:e=>t["~run"]({value:e},Ne())},t}var Ps=class extends Error{constructor(t){super(t[0].message),this.name="ValiError",this.issues=t}};function Rt(t){return{kind:"validation",type:"integer",reference:Rt,async:!1,expects:null,requirement:Number.isInteger,message:t,"~run"(e,n){return e.typed&&!this.requirement(e.value)&&x(this,"integer",e,n),e}}}function k(t,e){return{kind:"validation",type:"min_length",reference:k,async:!1,expects:`>=${t}`,requirement:t,message:e,"~run"(n,s){return n.typed&&n.value.length<this.requirement&&x(this,"length",n,s,{received:`${n.value.length}`}),n}}}function Lt(t,e){return{kind:"validation",type:"min_value",reference:Lt,async:!1,expects:`>=${t instanceof Date?t.toJSON():ne(t)}`,requirement:t,message:e,"~run"(n,s){return n.typed&&!(n.value>=this.requirement)&&x(this,"value",n,s,{received:n.value instanceof Date?n.value.toJSON():ne(n.value)}),n}}}function U(t,e){return{kind:"validation",type:"regex",reference:U,async:!1,expects:`${t}`,requirement:t,message:e,"~run"(n,s){return n.typed&&!this.requirement.test(n.value)&&x(this,"format",n,s),n}}}function De(){return{kind:"transformation",type:"trim",reference:De,async:!1,"~run"(t){return t.value=t.value.trim(),t}}}const Ds={abortEarly:!0};function Nt(t,e,n){return typeof t.fallback=="function"?t.fallback(e,n):t.fallback}function me(t,e,n){return typeof t.default=="function"?t.default(e,n):t.default}function q(t,e){return w({kind:"schema",type:"array",reference:q,expects:"Array",async:!1,item:t,message:e,"~run"(n,s){const r=n.value;if(Array.isArray(r)){n.typed=!0,n.value=[];for(let i=0;i<r.length;i++){const o=r[i],l=this.item["~run"]({value:o},s);if(l.issues){const a={type:"array",origin:"value",input:r,key:i,value:o};for(const d of l.issues)d.path?d.path.unshift(a):d.path=[a],n.issues?.push(d);if(n.issues||(n.issues=l.issues),s.abortEarly){n.typed=!1;break}}l.typed||(n.typed=!1),n.value.push(l.value)}}else x(this,"type",n,s);return n}})}function Pt(t){return w({kind:"schema",type:"boolean",reference:Pt,expects:"boolean",async:!1,message:t,"~run"(e,n){return typeof e.value=="boolean"?e.typed=!0:x(this,"type",e,n),e}})}function S(t,e){return w({kind:"schema",type:"exact_optional",reference:S,expects:t.expects,async:!1,wrapped:t,default:e,"~run"(n,s){return this.wrapped["~run"](n,s)}})}function Dt(t){return w({kind:"schema",type:"lazy",reference:Dt,expects:"unknown",async:!1,getter:t,"~run"(e,n){return this.getter(e.value)["~run"](e,n)}})}function F(t,e){return w({kind:"schema",type:"literal",reference:F,expects:ne(t),async:!1,literal:t,message:e,"~run"(n,s){return Ls(n.value,this.literal)?n.typed=!0:x(this,"type",n,s),n}})}function Ut(t,e){return w({kind:"schema",type:"nullable",reference:Ut,expects:`(${t.expects} | null)`,async:!1,wrapped:t,default:e,"~run"(n,s){return n.value===null&&(this.default!==void 0&&(n.value=me(this,n,s)),n.value===null)?(n.typed=!0,n):this.wrapped["~run"](n,s)}})}function qt(t){return w({kind:"schema",type:"number",reference:qt,expects:"number",async:!1,message:t,"~run"(e,n){return typeof e.value=="number"&&!isNaN(e.value)?e.typed=!0:x(this,"type",e,n),e}})}function $(t,e){return w({kind:"schema",type:"object",reference:$,expects:"Object",async:!1,entries:t,message:e,"~run"(n,s){const r=n.value;if(r&&typeof r=="object"){n.typed=!0,n.value={};for(const i in this.entries){const o=this.entries[i];if(i in r||(o.type==="exact_optional"||o.type==="optional"||o.type==="nullish")&&o.default!==void 0){const l=i in r?r[i]:me(o),a=o["~run"]({value:l},s);if(a.issues){const d={type:"object",origin:"value",input:r,key:i,value:l};for(const p of a.issues)p.path?p.path.unshift(d):p.path=[d],n.issues?.push(p);if(n.issues||(n.issues=a.issues),s.abortEarly){n.typed=!1;break}}a.typed||(n.typed=!1),n.value[i]=a.value}else if(o.fallback!==void 0)n.value[i]=Nt(o);else if(o.type!=="exact_optional"&&o.type!=="optional"&&o.type!=="nullish"&&(x(this,"key",n,s,{input:void 0,expected:`"${i}"`,path:[{type:"object",origin:"key",input:r,key:i,value:r[i]}]}),s.abortEarly))break}}else x(this,"type",n,s);return n}})}function ve(t,e){return w({kind:"schema",type:"optional",reference:ve,expects:`(${t.expects} | undefined)`,async:!1,wrapped:t,default:e,"~run"(n,s){return n.value===void 0&&(this.default!==void 0&&(n.value=me(this,n,s)),n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,s)}})}function be(t,e){return w({kind:"schema",type:"picklist",reference:be,expects:Pe(t.map(ne),"|"),async:!1,options:t,message:e,"~run"(n,s){return this.options.includes(n.value)?n.typed=!0:x(this,"type",n,s),n}})}function It(t,e,n){return w({kind:"schema",type:"record",reference:It,expects:"Object",async:!1,key:t,value:e,message:n,"~run"(s,r){const i=s.value;if(i&&typeof i=="object"){s.typed=!0,s.value={};for(const o in i)if(Ns(i,o)){const l=i[o],a=this.key["~run"]({value:o},r);if(a.issues){const p={type:"object",origin:"key",input:i,key:o,value:l};for(const c of a.issues)c.path=[p],s.issues?.push(c);if(s.issues||(s.issues=a.issues),r.abortEarly){s.typed=!1;break}}const d=this.value["~run"]({value:l},r);if(d.issues){const p={type:"object",origin:"value",input:i,key:o,value:l};for(const c of d.issues)c.path?c.path.unshift(p):c.path=[p],s.issues?.push(c);if(s.issues||(s.issues=d.issues),r.abortEarly){s.typed=!1;break}}(!a.typed||!d.typed)&&(s.typed=!1),a.typed&&(s.value[a.value]=d.value)}}else x(this,"type",s,r);return s}})}function K(t,e){return w({kind:"schema",type:"strict_object",reference:K,expects:"Object",async:!1,entries:t,message:e,"~run"(n,s){const r=n.value;if(r&&typeof r=="object"){n.typed=!0,n.value={};for(const i in this.entries){const o=this.entries[i];if(i in r||(o.type==="exact_optional"||o.type==="optional"||o.type==="nullish")&&o.default!==void 0){const l=i in r?r[i]:me(o),a=o["~run"]({value:l},s);if(a.issues){const d={type:"object",origin:"value",input:r,key:i,value:l};for(const p of a.issues)p.path?p.path.unshift(d):p.path=[d],n.issues?.push(p);if(n.issues||(n.issues=a.issues),s.abortEarly){n.typed=!1;break}}a.typed||(n.typed=!1),n.value[i]=a.value}else if(o.fallback!==void 0)n.value[i]=Nt(o);else if(o.type!=="exact_optional"&&o.type!=="optional"&&o.type!=="nullish"&&(x(this,"key",n,s,{input:void 0,expected:`"${i}"`,path:[{type:"object",origin:"key",input:r,key:i,value:r[i]}]}),s.abortEarly))break}if(!n.issues||!s.abortEarly){for(const i in r)if(!Object.prototype.hasOwnProperty.call(this.entries,i)){x(this,"key",n,s,{input:i,expected:"never",path:[{type:"object",origin:"key",input:r,key:i,value:r[i]}]});break}}}else x(this,"type",n,s);return n}})}function g(t){return w({kind:"schema",type:"string",reference:g,expects:"string",async:!1,message:t,"~run"(e,n){return typeof e.value=="string"?e.typed=!0:x(this,"type",e,n),e}})}function zt(t){let e;if(t)for(const n of t)if(e)for(const s of n.issues)e.push(s);else e=n.issues;return e}function Bt(t,e){return w({kind:"schema",type:"union",reference:Bt,expects:Pe(t.map(n=>n.expects),"|"),async:!1,options:t,message:e,"~run"(n,s){let r,i,o;for(const l of this.options){const a=l["~run"]({value:n.value},s);if(a.typed)if(a.issues)i?i.push(a):i=[a];else{r=a;break}else o?o.push(a):o=[a]}if(r)return r;if(i){if(i.length===1)return i[0];x(this,"type",n,s,{issues:zt(i)}),n.typed=!0}else{if(o?.length===1)return o[0];x(this,"type",n,s,{issues:zt(o)})}return n}})}function I(){return w({kind:"schema",type:"unknown",reference:I,expects:"unknown",async:!1,"~run"(t){return t.typed=!0,t}})}function Ht(t,e,n){return w({kind:"schema",type:"variant",reference:Ht,expects:"Object",async:!1,key:t,options:e,message:n,"~run"(s,r){const i=s.value;if(i&&typeof i=="object"){let o,l=0,a=this.key,d=[];const p=(c,h)=>{for(const u of c.options){if(u.type==="variant")p(u,new Set(h).add(u.key));else{let v=!0,C=0;for(const A of h){const j=u.entries[A];if(A in i?j["~run"]({typed:!1,value:i[A]},Ds).issues:j.type!=="exact_optional"&&j.type!=="optional"&&j.type!=="nullish"){v=!1,a!==A&&(l<C||l===C&&A in i&&!(a in i))&&(l=C,a=A,d=[]),a===A&&d.push(u.entries[A].expects);break}C++}if(v){const A=u["~run"]({value:i},r);(!o||!o.typed&&A.typed)&&(o=A)}}if(o&&!o.issues)break}};if(p(this,new Set([this.key])),o)return o;x(this,"type",s,r,{input:i[a],expected:Pe(d,"|"),path:[{type:"object",origin:"value",input:i,key:a,value:i[a]}]})}else x(this,"type",s,r);return s}})}function Ft(t,e,n){const s=t["~run"]({value:e},Ne());if(s.issues)throw new Ps(s.issues);return s.value}function b(...t){return w({...t[0],pipe:t,"~run"(e,n){for(const s of t)if(s.kind!=="metadata"){if(e.issues&&(s.kind==="schema"||s.kind==="transformation")){e.typed=!1;break}(!e.issues||!n.abortEarly&&!n.abortPipeEarly)&&(e=s["~run"](e,n))}return e}})}function y(t,e,n){const s=t["~run"]({value:e},Ne());return{typed:s.typed,success:!s.issues,output:s.value,issues:s.issues}}const ke=$({type:b(g(),k(1)),id:b(g(),k(1))}),Us=b(g(),k(1),U(/^[A-Za-z0-9_-]+$/,'ids may only contain letters, digits, "_" and "-" (a "." builds a path)')),qs=(t,e)=>{if(e===1)return t.includes(".")?null:[t];const n=t.split(".");return n.length===e&&n.every(s=>s.length>0)?n:null},J=$({id:b(g(),k(1)),type:b(g(),k(1)),target:ke,payload:I(),note:S(g()),createdAt:b(g(),k(1))}),Is=(t,e,n,s={})=>{const r=$({id:b(g(),k(1)),type:F(t),target:ke,payload:n,note:S(g()),createdAt:b(g(),k(1))}),i=o=>{const l=y(J,o);if(!l.success||l.output.type!==t)return null;const a=y(n,o.payload);return a.success?{id:l.output.id,type:t,target:l.output.target,payload:a.output,...l.output.note===void 0?{}:{note:l.output.note},createdAt:l.output.createdAt}:null};return{schema:r,mode:s.mode??"patch",targetType:e,actionType:t,payloadSchema:n,parse:i,...s.dedupeKey?{dedupeKey:s.dedupeKey}:{}}},zs=(t,e)=>{const n=ye(t,e.type);if(n===void 0)return null;const s=n.parse(e);return s===null?null:s},Bs=(t,e)=>{const n=y(t.payloadSchema,e.payload);if(!n.success)throw new Error(`invalid payload for action "${e.type}"`);return n.output},ye=(t,e)=>Object.hasOwn(t,e)?t[e]:void 0,Hs=t=>{throw new Error(`unhandled action: ${JSON.stringify(t)}`)},Fs=$({id:b(g(),k(1))}),Ks=t=>{const e=y(Fs,t.payload);return`${t.type}|${e.success?e.output.id:JSON.stringify(t.payload)}`},_=t=>`${t.type}:${t.id}`,Kt=t=>{const e=t.indexOf(":");return e<=0?{type:"unknown",id:t}:{type:t.slice(0,e),id:t.slice(e+1)}},Ue=(t,e)=>typeof t=="string"?Kt(t.includes(":")?t:`${e}:${t}`):{type:t.type,id:t.id},Js=(t,e)=>t.type===e.type&&t.id===e.id,Jt=t=>{const e=t.normalize("NFKD").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40);return e.length>0?e:"item"},Vs=(t,e)=>{const n=Jt(t),s=new Set(e);if(!s.has(n))return n;for(let r=2;r<1e3;r+=1){const i=`${n}-${r}`;if(!s.has(i))return i}return`${n}-${Math.random().toString(36).slice(2,8)}`},Vt=()=>{const t=globalThis.crypto;return t?.randomUUID?t.randomUUID():`a-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`},E="comment",se=t=>{const[e]=t;return{path:e?.path?.map(n=>String(n.key)).join(".")??"",message:e?.message??"invalid action"}},Wt=$({type:b(g(),k(1)),target:Bt([b(g(),k(1)),ke]),payload:ve(I()),note:S(g()),id:S(b(g(),k(1))),createdAt:S(b(g(),k(1)))}),Ws=(t,e)=>{const n=y(Wt,t);if(!n.success)return{ok:!1,issue:se(n.issues)};const s=n.output,r=Ue(s.target,e.targetType),i={id:s.id??Vt(),type:s.type,target:r,payload:s.payload??{},...s.note===void 0?{}:{note:s.note},createdAt:s.createdAt??new Date().toISOString()},o=y(e.schema,i);if(!o.success)return{ok:!1,issue:se(o.issues)};const l=y(J,o.output);return l.success?{ok:!0,action:l.output}:{ok:!1,issue:se(l.issues)}},qe=(t,e)=>e.dedupeKey?e.dedupeKey(t):e.mode!=="patch"?null:`${t.type}|${_(t.target)}`,Ie=(t,e,n)=>{const s=qe(e,n);if(s===null)return[...t,e];const r=t.at(-1);return!r||qe(r,n)!==s||!Ys(r,e)?[...t,e]:[...t.slice(0,-1),e]},Ys=(t,e)=>Js(t.target,e.target),ze=t=>JSON.stringify(t.map(e=>({id:e.id,type:e.type,target:e.target,payload:e.payload,...e.note===void 0?{}:{note:e.note},createdAt:e.createdAt})),null,2),Yt=$({id:b(g(),k(1)),type:F(E),target:$({type:b(g(),k(1)),id:b(g(),k(1))}),payload:$({body:b(g(),k(1))}),note:S(g()),createdAt:b(g(),k(1))}),Gt={schema:Yt,mode:"append",targetType:"page"},Gs=$({body:g()}),xe=t=>{const e=y(Gs,t.payload);return e.success?e.output.body:""},Be="element",Zt=b(g(),U(/^[A-Z][A-Z0-9_]*$/,"component action types are CONSTANT_CASE")),Qt=It(g(),I()),Zs=$({type:F(Be),id:b(g(),U(/^[^/]+\/.+/,"component references start with a provider id"))}),Qs=$({id:b(g(),k(1)),type:Zt,target:Zs,payload:Qt,note:S(g()),createdAt:b(g(),k(1))}),Xs={schema:Qs,mode:"sequence",targetType:Be},er=K({type:Zt,target:b(g(),U(/^element:[^/]+\/.+/)),payload:ve(Qt,{})}),Xt=K({id:b(g(),k(1)),title:b(g(),k(1)),summary:S(g()),tone:S(be(["create","update","delete","move","meta"])),stale:S(be(["unsupported-action-type","target-missing","constraint-violated"]))}),He=t=>{if(t.type!==Be)return null;const e=t.id.indexOf("/");if(e<=0)return null;try{return decodeURIComponent(t.id.slice(0,e))}catch{return null}},T=t=>t.type!==E&&He(t.target)!==null,tr=(t,e)=>t.filter(n=>T(n)&&He(n.target)===e),en=(t,e)=>{const n=new Map(t.flatMap(s=>T(s)?[[s.id,He(s.target)]]:[]));return new Map(e.flatMap(s=>s.results.flatMap(r=>n.get(r.id)===s.id?[[r.id,r]]:[])))},Fe=Object.freeze({}),Ke=t=>{const e=t.startsWith("#")?t.slice(1):t;if(e.length===0)return Fe;const n=new URLSearchParams(e.startsWith("?")?e.slice(1):e),s={};for(const[r,i]of n)r.length>0&&i.length>0&&(s[r]=i);return s},V=t=>{const e=new URLSearchParams;for(const s of Object.keys(t).sort((r,i)=>r<i?-1:r>i?1:0)){const r=t[s];r!=null&&r!==""&&e.set(s,r)}const n=e.toString();return n.length===0?"":`#${n}`},Je=(t,e,n=[])=>{const s={...t},r=Object.keys(e).map(i=>n.indexOf(i)).filter(i=>i>=0);if(r.length>0)for(const i of n.slice(Math.min(...r)+1))Object.hasOwn(e,i)||delete s[i];for(const[i,o]of Object.entries(e))o==null||o===""?delete s[i]:s[i]=o;return s},nr=(t,e="json")=>`\`\`\`${e}
|
|
511
|
+
`}#t=e=>{e.stopPropagation(),this.editing=!0};#i=e=>{e.isComposing||(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.editing=!0)};#n=e=>{const n=F(e.target,HTMLInputElement)??F(e.target,HTMLTextAreaElement);n!==null&&(this.#e=n.value)};#o=e=>{if(!e.isComposing){if(e.key==="Escape"){e.preventDefault(),this.#e=this.value,this.editing=!1;return}e.key==="Enter"&&(!this.multiline||this.wrap||e.metaKey||e.ctrlKey)&&(e.preventDefault(),this.#d())}};#a=e=>{const n=e.currentTarget;if(!(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement))return;const s=this.#r,{selectionStart:r,selectionEnd:i}=n;queueMicrotask(()=>{!this.isConnected||!this.editing||(s!==this.#r?(n.focus(),n.setSelectionRange(r,i)):this.#d())})};#d=()=>{if(!this.editing)return;this.editing=!1;const n=(this.wrap?this.#e.replace(/\r?\n/g," "):this.#e).trim();n!==this.value&&this.dispatchEvent(new CustomEvent("dpk-commit",{detail:{value:n},bubbles:!0,composed:!0}))}}const Ss=()=>{customElements.get("dpk-component-inline-edit")||customElements.define("dpk-component-inline-edit",Rt)},_s={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0};function Pe(t){return _s}let Es;function Ts(t){return Es?.get(t)}let Ms;function Os(t){return Ms?.get(t)}let js;function Rs(t,e){return js?.get(t)?.get(e)}function ne(t){const e=typeof t;return e==="string"?`"${t}"`:e==="number"||e==="bigint"||e==="boolean"?`${t}`:e==="object"||e==="function"?(t&&Object.getPrototypeOf(t)?.constructor?.name)??"null":e}function x(t,e,n,s,r){const i=r&&"input"in r?r.input:n.value,o=r?.expected??t.expects??null,l=r?.received??ne(i),a={kind:t.kind,type:t.type,input:i,expected:o,received:l,message:`Invalid ${e}: ${o?`Expected ${o} but r`:"R"}eceived ${l}`,requirement:t.requirement,path:r?.path,issues:r?.issues,lang:s.lang,abortEarly:s.abortEarly,abortPipeEarly:s.abortPipeEarly},d=t.kind==="schema",p=r?.message??t.message??Rs(t.reference,a.lang)??(d?Os(a.lang):null)??s.message??Ts(a.lang);p!==void 0&&(a.message=typeof p=="function"?p(a):p),d&&(n.typed=!1),n.issues?n.issues.push(a):n.issues=[a]}function Ls(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}function Ns(t,e){return Object.prototype.hasOwnProperty.call(t,e)&&e!=="__proto__"&&e!=="prototype"&&e!=="constructor"}function De(t,e){const n=[...new Set(t)];return n.length>1?`(${n.join(` ${e} `)})`:n[0]??"never"}function w(t){return t["~standard"]={version:1,vendor:"valibot",validate:e=>t["~run"]({value:e},Pe())},t}var Ps=class extends Error{constructor(t){super(t[0].message),this.name="ValiError",this.issues=t}};function Lt(t){return{kind:"validation",type:"integer",reference:Lt,async:!1,expects:null,requirement:Number.isInteger,message:t,"~run"(e,n){return e.typed&&!this.requirement(e.value)&&x(this,"integer",e,n),e}}}function k(t,e){return{kind:"validation",type:"min_length",reference:k,async:!1,expects:`>=${t}`,requirement:t,message:e,"~run"(n,s){return n.typed&&n.value.length<this.requirement&&x(this,"length",n,s,{received:`${n.value.length}`}),n}}}function Nt(t,e){return{kind:"validation",type:"min_value",reference:Nt,async:!1,expects:`>=${t instanceof Date?t.toJSON():ne(t)}`,requirement:t,message:e,"~run"(n,s){return n.typed&&!(n.value>=this.requirement)&&x(this,"value",n,s,{received:n.value instanceof Date?n.value.toJSON():ne(n.value)}),n}}}function I(t,e){return{kind:"validation",type:"regex",reference:I,async:!1,expects:`${t}`,requirement:t,message:e,"~run"(n,s){return n.typed&&!this.requirement.test(n.value)&&x(this,"format",n,s),n}}}function Ie(){return{kind:"transformation",type:"trim",reference:Ie,async:!1,"~run"(t){return t.value=t.value.trim(),t}}}const Ds={abortEarly:!0};function Pt(t,e,n){return typeof t.fallback=="function"?t.fallback(e,n):t.fallback}function me(t,e,n){return typeof t.default=="function"?t.default(e,n):t.default}function U(t,e){return w({kind:"schema",type:"array",reference:U,expects:"Array",async:!1,item:t,message:e,"~run"(n,s){const r=n.value;if(Array.isArray(r)){n.typed=!0,n.value=[];for(let i=0;i<r.length;i++){const o=r[i],l=this.item["~run"]({value:o},s);if(l.issues){const a={type:"array",origin:"value",input:r,key:i,value:o};for(const d of l.issues)d.path?d.path.unshift(a):d.path=[a],n.issues?.push(d);if(n.issues||(n.issues=l.issues),s.abortEarly){n.typed=!1;break}}l.typed||(n.typed=!1),n.value.push(l.value)}}else x(this,"type",n,s);return n}})}function Dt(t){return w({kind:"schema",type:"boolean",reference:Dt,expects:"boolean",async:!1,message:t,"~run"(e,n){return typeof e.value=="boolean"?e.typed=!0:x(this,"type",e,n),e}})}function S(t,e){return w({kind:"schema",type:"exact_optional",reference:S,expects:t.expects,async:!1,wrapped:t,default:e,"~run"(n,s){return this.wrapped["~run"](n,s)}})}function It(t){return w({kind:"schema",type:"lazy",reference:It,expects:"unknown",async:!1,getter:t,"~run"(e,n){return this.getter(e.value)["~run"](e,n)}})}function K(t,e){return w({kind:"schema",type:"literal",reference:K,expects:ne(t),async:!1,literal:t,message:e,"~run"(n,s){return Ls(n.value,this.literal)?n.typed=!0:x(this,"type",n,s),n}})}function Ut(t,e){return w({kind:"schema",type:"nullable",reference:Ut,expects:`(${t.expects} | null)`,async:!1,wrapped:t,default:e,"~run"(n,s){return n.value===null&&(this.default!==void 0&&(n.value=me(this,n,s)),n.value===null)?(n.typed=!0,n):this.wrapped["~run"](n,s)}})}function qt(t){return w({kind:"schema",type:"number",reference:qt,expects:"number",async:!1,message:t,"~run"(e,n){return typeof e.value=="number"&&!isNaN(e.value)?e.typed=!0:x(this,"type",e,n),e}})}function $(t,e){return w({kind:"schema",type:"object",reference:$,expects:"Object",async:!1,entries:t,message:e,"~run"(n,s){const r=n.value;if(r&&typeof r=="object"){n.typed=!0,n.value={};for(const i in this.entries){const o=this.entries[i];if(i in r||(o.type==="exact_optional"||o.type==="optional"||o.type==="nullish")&&o.default!==void 0){const l=i in r?r[i]:me(o),a=o["~run"]({value:l},s);if(a.issues){const d={type:"object",origin:"value",input:r,key:i,value:l};for(const p of a.issues)p.path?p.path.unshift(d):p.path=[d],n.issues?.push(p);if(n.issues||(n.issues=a.issues),s.abortEarly){n.typed=!1;break}}a.typed||(n.typed=!1),n.value[i]=a.value}else if(o.fallback!==void 0)n.value[i]=Pt(o);else if(o.type!=="exact_optional"&&o.type!=="optional"&&o.type!=="nullish"&&(x(this,"key",n,s,{input:void 0,expected:`"${i}"`,path:[{type:"object",origin:"key",input:r,key:i,value:r[i]}]}),s.abortEarly))break}}else x(this,"type",n,s);return n}})}function ve(t,e){return w({kind:"schema",type:"optional",reference:ve,expects:`(${t.expects} | undefined)`,async:!1,wrapped:t,default:e,"~run"(n,s){return n.value===void 0&&(this.default!==void 0&&(n.value=me(this,n,s)),n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,s)}})}function be(t,e){return w({kind:"schema",type:"picklist",reference:be,expects:De(t.map(ne),"|"),async:!1,options:t,message:e,"~run"(n,s){return this.options.includes(n.value)?n.typed=!0:x(this,"type",n,s),n}})}function zt(t,e,n){return w({kind:"schema",type:"record",reference:zt,expects:"Object",async:!1,key:t,value:e,message:n,"~run"(s,r){const i=s.value;if(i&&typeof i=="object"){s.typed=!0,s.value={};for(const o in i)if(Ns(i,o)){const l=i[o],a=this.key["~run"]({value:o},r);if(a.issues){const p={type:"object",origin:"key",input:i,key:o,value:l};for(const c of a.issues)c.path=[p],s.issues?.push(c);if(s.issues||(s.issues=a.issues),r.abortEarly){s.typed=!1;break}}const d=this.value["~run"]({value:l},r);if(d.issues){const p={type:"object",origin:"value",input:i,key:o,value:l};for(const c of d.issues)c.path?c.path.unshift(p):c.path=[p],s.issues?.push(c);if(s.issues||(s.issues=d.issues),r.abortEarly){s.typed=!1;break}}(!a.typed||!d.typed)&&(s.typed=!1),a.typed&&(s.value[a.value]=d.value)}}else x(this,"type",s,r);return s}})}function J(t,e){return w({kind:"schema",type:"strict_object",reference:J,expects:"Object",async:!1,entries:t,message:e,"~run"(n,s){const r=n.value;if(r&&typeof r=="object"){n.typed=!0,n.value={};for(const i in this.entries){const o=this.entries[i];if(i in r||(o.type==="exact_optional"||o.type==="optional"||o.type==="nullish")&&o.default!==void 0){const l=i in r?r[i]:me(o),a=o["~run"]({value:l},s);if(a.issues){const d={type:"object",origin:"value",input:r,key:i,value:l};for(const p of a.issues)p.path?p.path.unshift(d):p.path=[d],n.issues?.push(p);if(n.issues||(n.issues=a.issues),s.abortEarly){n.typed=!1;break}}a.typed||(n.typed=!1),n.value[i]=a.value}else if(o.fallback!==void 0)n.value[i]=Pt(o);else if(o.type!=="exact_optional"&&o.type!=="optional"&&o.type!=="nullish"&&(x(this,"key",n,s,{input:void 0,expected:`"${i}"`,path:[{type:"object",origin:"key",input:r,key:i,value:r[i]}]}),s.abortEarly))break}if(!n.issues||!s.abortEarly){for(const i in r)if(!Object.prototype.hasOwnProperty.call(this.entries,i)){x(this,"key",n,s,{input:i,expected:"never",path:[{type:"object",origin:"key",input:r,key:i,value:r[i]}]});break}}}else x(this,"type",n,s);return n}})}function g(t){return w({kind:"schema",type:"string",reference:g,expects:"string",async:!1,message:t,"~run"(e,n){return typeof e.value=="string"?e.typed=!0:x(this,"type",e,n),e}})}function Bt(t){let e;if(t)for(const n of t)if(e)for(const s of n.issues)e.push(s);else e=n.issues;return e}function Ht(t,e){return w({kind:"schema",type:"union",reference:Ht,expects:De(t.map(n=>n.expects),"|"),async:!1,options:t,message:e,"~run"(n,s){let r,i,o;for(const l of this.options){const a=l["~run"]({value:n.value},s);if(a.typed)if(a.issues)i?i.push(a):i=[a];else{r=a;break}else o?o.push(a):o=[a]}if(r)return r;if(i){if(i.length===1)return i[0];x(this,"type",n,s,{issues:Bt(i)}),n.typed=!0}else{if(o?.length===1)return o[0];x(this,"type",n,s,{issues:Bt(o)})}return n}})}function q(){return w({kind:"schema",type:"unknown",reference:q,expects:"unknown",async:!1,"~run"(t){return t.typed=!0,t}})}function Ft(t,e,n){return w({kind:"schema",type:"variant",reference:Ft,expects:"Object",async:!1,key:t,options:e,message:n,"~run"(s,r){const i=s.value;if(i&&typeof i=="object"){let o,l=0,a=this.key,d=[];const p=(c,h)=>{for(const u of c.options){if(u.type==="variant")p(u,new Set(h).add(u.key));else{let v=!0,C=0;for(const A of h){const j=u.entries[A];if(A in i?j["~run"]({typed:!1,value:i[A]},Ds).issues:j.type!=="exact_optional"&&j.type!=="optional"&&j.type!=="nullish"){v=!1,a!==A&&(l<C||l===C&&A in i&&!(a in i))&&(l=C,a=A,d=[]),a===A&&d.push(u.entries[A].expects);break}C++}if(v){const A=u["~run"]({value:i},r);(!o||!o.typed&&A.typed)&&(o=A)}}if(o&&!o.issues)break}};if(p(this,new Set([this.key])),o)return o;x(this,"type",s,r,{input:i[a],expected:De(d,"|"),path:[{type:"object",origin:"value",input:i,key:a,value:i[a]}]})}else x(this,"type",s,r);return s}})}function Kt(t,e,n){const s=t["~run"]({value:e},Pe());if(s.issues)throw new Ps(s.issues);return s.value}function b(...t){return w({...t[0],pipe:t,"~run"(e,n){for(const s of t)if(s.kind!=="metadata"){if(e.issues&&(s.kind==="schema"||s.kind==="transformation")){e.typed=!1;break}(!e.issues||!n.abortEarly&&!n.abortPipeEarly)&&(e=s["~run"](e,n))}return e}})}function y(t,e,n){const s=t["~run"]({value:e},Pe());return{typed:s.typed,success:!s.issues,output:s.value,issues:s.issues}}const ke=$({type:b(g(),k(1)),id:b(g(),k(1))}),Is=b(g(),k(1),I(/^[A-Za-z0-9_-]+$/,'ids may only contain letters, digits, "_" and "-" (a "." builds a path)')),Us=(t,e)=>{if(e===1)return t.includes(".")?null:[t];const n=t.split(".");return n.length===e&&n.every(s=>s.length>0)?n:null},V=$({id:b(g(),k(1)),type:b(g(),k(1)),target:ke,payload:q(),note:S(g()),createdAt:b(g(),k(1))}),qs=(t,e,n,s={})=>{const r=$({id:b(g(),k(1)),type:K(t),target:ke,payload:n,note:S(g()),createdAt:b(g(),k(1))}),i=o=>{const l=y(V,o);if(!l.success||l.output.type!==t)return null;const a=y(n,o.payload);return a.success?{id:l.output.id,type:t,target:l.output.target,payload:a.output,...l.output.note===void 0?{}:{note:l.output.note},createdAt:l.output.createdAt}:null};return{schema:r,mode:s.mode??"patch",targetType:e,actionType:t,payloadSchema:n,parse:i,...s.dedupeKey?{dedupeKey:s.dedupeKey}:{}}},zs=(t,e)=>{const n=ye(t,e.type);if(n===void 0)return null;const s=n.parse(e);return s===null?null:s},Bs=(t,e)=>{const n=y(t.payloadSchema,e.payload);if(!n.success)throw new Error(`invalid payload for action "${e.type}"`);return n.output},ye=(t,e)=>Object.hasOwn(t,e)?t[e]:void 0,Hs=t=>{throw new Error(`unhandled action: ${JSON.stringify(t)}`)},Fs=$({id:b(g(),k(1))}),Ks=t=>{const e=y(Fs,t.payload);return`${t.type}|${e.success?e.output.id:JSON.stringify(t.payload)}`},_=t=>`${t.type}:${t.id}`,Jt=t=>{const e=t.indexOf(":");return e<=0?{type:"unknown",id:t}:{type:t.slice(0,e),id:t.slice(e+1)}},Ue=(t,e)=>typeof t=="string"?Jt(t.includes(":")?t:`${e}:${t}`):{type:t.type,id:t.id},Js=(t,e)=>t.type===e.type&&t.id===e.id,Vt=t=>{const e=t.normalize("NFKD").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40);return e.length>0?e:"item"},Vs=(t,e)=>{const n=Vt(t),s=new Set(e);if(!s.has(n))return n;for(let r=2;r<1e3;r+=1){const i=`${n}-${r}`;if(!s.has(i))return i}return`${n}-${Math.random().toString(36).slice(2,8)}`},Wt=()=>{const t=globalThis.crypto;return t?.randomUUID?t.randomUUID():`a-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`},E="comment",se=t=>{const[e]=t;return{path:e?.path?.map(n=>String(n.key)).join(".")??"",message:e?.message??"invalid action"}},Yt=$({type:b(g(),k(1)),target:Ht([b(g(),k(1)),ke]),payload:ve(q()),note:S(g()),id:S(b(g(),k(1))),createdAt:S(b(g(),k(1)))}),Ws=(t,e)=>{const n=y(Yt,t);if(!n.success)return{ok:!1,issue:se(n.issues)};const s=n.output,r=Ue(s.target,e.targetType),i={id:s.id??Wt(),type:s.type,target:r,payload:s.payload??{},...s.note===void 0?{}:{note:s.note},createdAt:s.createdAt??new Date().toISOString()},o=y(e.schema,i);if(!o.success)return{ok:!1,issue:se(o.issues)};const l=y(V,o.output);return l.success?{ok:!0,action:l.output}:{ok:!1,issue:se(l.issues)}},qe=(t,e)=>e.dedupeKey?e.dedupeKey(t):e.mode!=="patch"?null:`${t.type}|${_(t.target)}`,ze=(t,e,n)=>{const s=qe(e,n);if(s===null)return[...t,e];const r=t.at(-1);return!r||qe(r,n)!==s||!Ys(r,e)?[...t,e]:[...t.slice(0,-1),e]},Ys=(t,e)=>Js(t.target,e.target),Be=t=>JSON.stringify(t.map(e=>({id:e.id,type:e.type,target:e.target,payload:e.payload,...e.note===void 0?{}:{note:e.note},createdAt:e.createdAt})),null,2),Gt=$({id:b(g(),k(1)),type:K(E),target:$({type:b(g(),k(1)),id:b(g(),k(1))}),payload:$({body:b(g(),k(1))}),note:S(g()),createdAt:b(g(),k(1))}),Zt={schema:Gt,mode:"append",targetType:"page"},Gs=$({body:g()}),xe=t=>{const e=y(Gs,t.payload);return e.success?e.output.body:""},He="element",Qt=b(g(),I(/^[A-Z][A-Z0-9_]*$/,"component action types are CONSTANT_CASE")),Xt=zt(g(),q()),Zs=$({type:K(He),id:b(g(),I(/^[^/]+\/.+/,"component references start with a provider id"))}),Qs=$({id:b(g(),k(1)),type:Qt,target:Zs,payload:Xt,note:S(g()),createdAt:b(g(),k(1))}),Xs={schema:Qs,mode:"sequence",targetType:He},er=J({type:Qt,target:b(g(),I(/^element:[^/]+\/.+/)),payload:ve(Xt,{})}),en=J({id:b(g(),k(1)),title:b(g(),k(1)),summary:S(g()),tone:S(be(["create","update","delete","move","meta"])),stale:S(be(["unsupported-action-type","target-missing","constraint-violated"]))}),Fe=t=>{if(t.type!==He)return null;const e=t.id.indexOf("/");if(e<=0)return null;try{return decodeURIComponent(t.id.slice(0,e))}catch{return null}},T=t=>t.type!==E&&Fe(t.target)!==null,tr=(t,e)=>t.filter(n=>T(n)&&Fe(n.target)===e),tn=(t,e)=>{const n=new Map(t.flatMap(s=>T(s)?[[s.id,Fe(s.target)]]:[]));return new Map(e.flatMap(s=>s.results.flatMap(r=>n.get(r.id)===s.id?[[r.id,r]]:[])))},Ke=Object.freeze({}),Je=t=>{const e=t.startsWith("#")?t.slice(1):t;if(e.length===0)return Ke;const n=new URLSearchParams(e.startsWith("?")?e.slice(1):e),s={};for(const[r,i]of n)r.length>0&&i.length>0&&(s[r]=i);return s},W=t=>{const e=new URLSearchParams;for(const s of Object.keys(t).sort((r,i)=>r<i?-1:r>i?1:0)){const r=t[s];r!=null&&r!==""&&e.set(s,r)}const n=e.toString();return n.length===0?"":`#${n}`},Ve=(t,e,n=[])=>{const s={...t},r=Object.keys(e).map(i=>n.indexOf(i)).filter(i=>i>=0);if(r.length>0)for(const i of n.slice(Math.min(...r)+1))Object.hasOwn(e,i)||delete s[i];for(const[i,o]of Object.entries(e))o==null||o===""?delete s[i]:s[i]=o;return s},nr=(t,e="json")=>`\`\`\`${e}
|
|
512
512
|
${t}
|
|
513
|
-
\`\`\``,sr=t=>JSON.stringify({type:t.type,target:t.target,payload:t.payload,...t.note===void 0?{}:{note:t.note}},null,2),
|
|
513
|
+
\`\`\``,sr=t=>JSON.stringify({type:t.type,target:t.target,payload:t.payload,...t.note===void 0?{}:{note:t.note}},null,2),We=(t,e,n)=>{const{actions:s,state:r}=t,i=new Set(t.stale.map(p=>p.action.id)),o=s.filter(p=>!i.has(p.id)),l=o.filter(p=>p.type===E),a=o.filter(p=>p.type!==E),d=[];if(d.push(`# Review draft \u2014 ${e.label}`),d.push(""),d.push(`- template: \`${e.name}\``),d.push(`- framework: \`dev-process-kit@${n}\``),d.push(`- navigation: \`${W(t.navigation)||"(none)"}\``),d.push(`- pending: ${a.length} change(s), ${l.length} comment(s)`),t.stale.length>0&&d.push(`- stale (not applicable to the current base): ${t.stale.length}`),d.push(""),d.push("## How to apply"),d.push(""),d.push("These are patches against the base HTML, not a command log. Apply the requested end state to the meaning model, keep the stable ids of surviving concepts, and keep the base JSON free of any draft envelope."),a.some(T)&&(d.push(""),d.push("Changes targeting `element:<id>/\u2026` belong to the component with that `id` (for example a diagram): apply them to that component's own JSON, following its documented action vocabulary.")),d.push(""),l.length>0){d.push(`## Comments (${l.length})`),d.push("");for(const[p,c]of l.entries()){const h=e.describe(c,r,t.base);d.push(`${p+1}. **${h.targetLabel}** \u2014 \`${_(c.target)}\``),d.push(` > ${xe(c).replace(/\n/g,`
|
|
514
514
|
> `)}`)}d.push("")}if(a.length>0){d.push(`## Requested changes (${a.length})`),d.push("");for(const[p,c]of a.entries()){const h=e.describe(c,r,t.base),u=h.summary?` \u2014 ${h.summary}`:"";d.push(`${p+1}. **${h.title}**${u}`),d.push(` target: \`${_(c.target)}\` (${c.target.type})`),d.push(` \`\`\`json
|
|
515
515
|
${sr(c).replace(/\n/g,`
|
|
516
516
|
`)}
|
|
517
|
-
\`\`\``)}d.push("")}if(a.length===0&&l.length===0&&(d.push("_No pending draft actions._"),d.push("")),t.stale.length>0){d.push(`## Not applicable to the current base (${t.stale.length})`),d.push(""),d.push("These actions were made against an earlier base and no longer fit it. Do not apply them; mention them if they still matter. The reader can remove them from the review rail."),d.push("");for(const[p,{action:c,reason:h}]of t.stale.entries()){const u=e.describe(c,r,t.base),v=c.type===E?xe(c):u.title;d.push(`${p+1}. \`${c.type}\` on \`${_(c.target)}\` (${h}) \u2014 ${v}`)}d.push("")}return d.push("## Canonical draft (JSON)"),d.push(""),d.push(nr(
|
|
518
|
-
`)},
|
|
517
|
+
\`\`\``)}d.push("")}if(a.length===0&&l.length===0&&(d.push("_No pending draft actions._"),d.push("")),t.stale.length>0){d.push(`## Not applicable to the current base (${t.stale.length})`),d.push(""),d.push("These actions were made against an earlier base and no longer fit it. Do not apply them; mention them if they still matter. The reader can remove them from the review rail."),d.push("");for(const[p,{action:c,reason:h}]of t.stale.entries()){const u=e.describe(c,r,t.base),v=c.type===E?xe(c):u.title;d.push(`${p+1}. \`${c.type}\` on \`${_(c.target)}\` (${h}) \u2014 ${v}`)}d.push("")}return d.push("## Canonical draft (JSON)"),d.push(""),d.push(nr(Be(s))),d.push(""),d.join(`
|
|
518
|
+
`)},Y="0.0.6",Ye=async t=>{try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(t),!0}catch{}const e=document.activeElement,n=document.createElement("textarea");try{return n.value=t,n.setAttribute("readonly",""),n.style.position="fixed",n.style.opacity="0",document.body.append(n),n.select(),document.execCommand("copy")}catch{return!1}finally{n.remove(),e instanceof HTMLElement&&e.focus()}},nn=ue({en:{heading:"Review notes",rejected:"Action rejected.",commentLabel:"Review comment",commentPlaceholder:"What should change, or what you noticed (passed to the agent as an instruction)",detach:"Detach",attachTo:t=>`Attach to this ${t}`,addNote:"Add note",empty:"No draft actions yet.",emptyHint:"Comments and structural patches both land here, and survive reload via LocalStorage.",sendToClaude:"Send to Claude",copy:"Copy changes & comments",copyTitle:"Copy the review to paste it to the agent",clear:"Clear",deleteAction:"Delete this draft action",wholePage:"Whole page",comment:"Comment",sent:"Sent to Claude \u2713",copied:"Copied \u2713",copyFailed:"Could not copy"},ja:{heading:"\u30EC\u30D3\u30E5\u30FC\u30CE\u30FC\u30C8",rejected:"action \u3092\u53D7\u3051\u4ED8\u3051\u3089\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002",commentLabel:"\u30EC\u30D3\u30E5\u30FC\u30B3\u30E1\u30F3\u30C8",commentPlaceholder:"\u5909\u66F4\u3057\u305F\u3044\u3053\u3068 / \u6C17\u3065\u304D\u3092\u66F8\u304F\uFF08Agent \u3078\u306E\u6307\u793A\u3068\u3057\u3066\u6E21\u308B\uFF09",detach:"\u7D10\u3065\u3051\u3092\u89E3\u9664",attachTo:t=>`\u3053\u306E ${t} \u306B\u7D10\u3065\u3051\u308B`,addNote:"\u30CE\u30FC\u30C8\u3092\u8FFD\u52A0",empty:"draft action \u306F\u307E\u3060\u3042\u308A\u307E\u305B\u3093\u3002",emptyHint:"\u30B3\u30E1\u30F3\u30C8\u3082\u69CB\u9020\u306E\u5909\u66F4\u3082\u3053\u3053\u306B\u96C6\u307E\u308A\u3001LocalStorage \u306B\u6B8B\u308B\u306E\u3067\u30EA\u30ED\u30FC\u30C9\u3057\u3066\u3082\u6D88\u3048\u307E\u305B\u3093\u3002",sendToClaude:"Claude \u306B\u9001\u308B",copy:"\u5909\u66F4\u30FB\u30B3\u30E1\u30F3\u30C8\u3092\u30B3\u30D4\u30FC",copyTitle:"Review \u3092\u30B3\u30D4\u30FC\u3057\u3066 Agent \u306B\u8CBC\u308A\u4ED8\u3051\u308B",clear:"\u30AF\u30EA\u30A2",deleteAction:"\u3053\u306E draft action \u3092\u524A\u9664",wholePage:"\u30DA\u30FC\u30B8\u5168\u4F53",comment:"\u30B3\u30E1\u30F3\u30C8",sent:"Claude \u306B\u9001\u308A\u307E\u3057\u305F \u2713",copied:"\u30B3\u30D4\u30FC\u3057\u307E\u3057\u305F \u2713",copyFailed:"\u30B3\u30D4\u30FC\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F"}}),rr=()=>({body:"",attachment:{kind:"page"},copy:{kind:"idle"},copyRequest:0,send:{kind:"idle"},sendRequest:0}),sn=t=>t.kind==="explicit"?{kind:t.resume}:t,rn=(t,e)=>{switch(e.kind){case"input":return{...t,body:e.body};case"attach":return{...t,attachment:{kind:e.current?"current":"page"}};case"clear-target":return{...t,attachment:sn(t.attachment)};case"target-requested":return{...t,attachment:{kind:"explicit",ref:e.ref,resume:t.attachment.kind==="explicit"?t.attachment.resume:t.attachment.kind}};case"submitted":return{...t,body:"",attachment:sn(t.attachment),copy:{kind:"idle"},copyRequest:t.copyRequest+1,send:{kind:"idle"},sendRequest:t.sendRequest+1};case"copy-started":return{...t,copy:{kind:"pending"},copyRequest:t.copyRequest+1,send:{kind:"idle"},sendRequest:t.sendRequest+1};case"copy-finished":return e.request!==t.copyRequest||t.copy.kind!=="pending"?t:{...t,copy:{kind:e.ok?"copied":"failed"}};case"send-started":return{...t,send:{kind:"pending"},sendRequest:t.sendRequest+1,copy:{kind:"idle"},copyRequest:t.copyRequest+1};case"send-finished":return e.request!==t.sendRequest||t.send.kind!=="pending"?t:{...t,send:e.outcome.ok?{kind:"sent"}:{kind:"failed",reason:e.outcome.reason}}}},ir=(t,e)=>{const n=t.body.trim();return n===""?null:{target:e,body:n}},or={en:"English",ja:"\u65E5\u672C\u8A9E"},G=ue({en:{review:"Review",reviewToggle:"Review / comments",useLightTheme:"Switch to light theme",useDarkTheme:"Switch to dark theme",language:"Language",baseDataError:"Could not read the base data (showing an empty page)",handoffTooLarge:"The review is too long to send. Copy it and paste it instead",handoffConsent:"Commenting needs your permission. Allow it, then send again",handoffForbidden:"This page cannot send to Claude. Copy the review and paste it instead",handoffClaudeUnavailable:"Could not reach the Claude session. Copy the review and paste it instead",handoffRateLimited:"Too many sends in a row. Wait a moment, then send again",handoffStorage:"Could not save the review. Copy it and paste it instead",handoffError:"Could not send. Copy the review and paste it instead",handoffLabel:"Hand the review to the agent",handoffSend:"Send to Claude",handoffSending:"Sending\u2026",handoffSent:"Sent to Claude \u2713",handoffCopy:"Copy changes & comments",handoffCopyTitle:"Copy the review to paste it to the agent",handoffCopied:"Copied \u2713",handoffCopyFailed:"Could not copy"},ja:{review:"\u30EC\u30D3\u30E5\u30FC",reviewToggle:"\u30EC\u30D3\u30E5\u30FC / \u30B3\u30E1\u30F3\u30C8",useLightTheme:"\u30E9\u30A4\u30C8\u30C6\u30FC\u30DE\u306B\u3059\u308B",useDarkTheme:"\u30C0\u30FC\u30AF\u30C6\u30FC\u30DE\u306B\u3059\u308B",language:"\u8A00\u8A9E",baseDataError:"base data \u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3067\u3057\u305F\uFF08\u7A7A\u306E\u30DA\u30FC\u30B8\u3068\u3057\u3066\u8868\u793A\u4E2D\uFF09",handoffTooLarge:"Review \u304C\u9577\u3059\u304E\u3066\u9001\u308C\u307E\u305B\u3093\u3002\u30B3\u30D4\u30FC\u3057\u3066\u6E21\u3057\u3066\u304F\u3060\u3055\u3044",handoffConsent:"\u30B3\u30E1\u30F3\u30C8\u306E\u8A31\u53EF\u304C\u5FC5\u8981\u3067\u3059\u3002\u8A31\u53EF\u3057\u3066\u304B\u3089\u3082\u3046\u4E00\u5EA6\u9001\u3063\u3066\u304F\u3060\u3055\u3044",handoffForbidden:"\u3053\u306E\u30DA\u30FC\u30B8\u304B\u3089\u306F\u9001\u308C\u307E\u305B\u3093\u3002\u30B3\u30D4\u30FC\u3057\u3066\u6E21\u3057\u3066\u304F\u3060\u3055\u3044",handoffClaudeUnavailable:"Claude \u306E\u30BB\u30C3\u30B7\u30E7\u30F3\u306B\u5C4A\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u30B3\u30D4\u30FC\u3057\u3066\u6E21\u3057\u3066\u304F\u3060\u3055\u3044",handoffRateLimited:"\u9001\u4FE1\u304C\u7D9A\u3044\u3066\u3044\u307E\u3059\u3002\u5C11\u3057\u5F85\u3063\u3066\u304B\u3089\u9001\u3063\u3066\u304F\u3060\u3055\u3044",handoffStorage:"Review \u3092\u4FDD\u5B58\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u30B3\u30D4\u30FC\u3057\u3066\u6E21\u3057\u3066\u304F\u3060\u3055\u3044",handoffError:"\u9001\u308C\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u30B3\u30D4\u30FC\u3057\u3066\u6E21\u3057\u3066\u304F\u3060\u3055\u3044",handoffLabel:"Review \u3092 Agent \u306B\u6E21\u3059",handoffSend:"Claude \u306B\u9001\u308B",handoffSending:"\u9001\u4FE1\u4E2D\u2026",handoffSent:"Claude \u306B\u9001\u308A\u307E\u3057\u305F \u2713",handoffCopy:"\u5909\u66F4\u30FB\u30B3\u30E1\u30F3\u30C8\u3092\u30B3\u30D4\u30FC",handoffCopyTitle:"Review \u3092\u30B3\u30D4\u30FC\u3057\u3066 Agent \u306B\u8CBC\u308A\u4ED8\u3051\u308B",handoffCopied:"\u30B3\u30D4\u30FC\u3057\u307E\u3057\u305F \u2713",handoffCopyFailed:"\u30B3\u30D4\u30FC\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F"}}),ar=4096,dr="reviews",on="Review from the page (dev-process-kit). Apply it to the base data and republish this artifact. Then answer with ArtifactComments `reply` in this thread: the reader sees only this thread, and the page never shows anything written to the database.",lr=t=>new TextEncoder().encode(t).length,cr=t=>t.replace(/[\u0000-\u0008\u000B-\u001F\u007F]/g,""),pr=t=>{const e=`${on}
|
|
519
519
|
|
|
520
|
-
${cr(t)}`;return lr(e)<=ar?e:null},hr=t=>`${
|
|
520
|
+
${cr(t)}`;return lr(e)<=ar?e:null},hr=t=>`${on}
|
|
521
521
|
|
|
522
|
-
The brief is too long for a comment, so it is stored in this artifact's database: read the document \`${t}\` (\`brief\` is the review, \`draft\` the raw draft JSON).`,ur={consent_required:"consent",forbidden:"forbidden",not_granted:"forbidden",capability_disabled:"forbidden",capability_removed:"forbidden",claude_unavailable:"claude_unavailable",rate_limited:"rate_limited"},fr=t=>{const e=typeof t=="object"&&t!==null&&"code"in t?t.code:void 0;return(typeof e=="string"?ur[e]:void 0)??"error"},gr={too_large:"handoffTooLarge",consent:"handoffConsent",forbidden:"handoffForbidden",claude_unavailable:"handoffClaudeUnavailable",rate_limited:"handoffRateLimited",storage:"handoffStorage",error:"handoffError"},
|
|
522
|
+
The brief is too long for a comment, so it is stored in this artifact's database: read the document \`${t}\` (\`brief\` is the review, \`draft\` the raw draft JSON).`,ur={consent_required:"consent",forbidden:"forbidden",not_granted:"forbidden",capability_disabled:"forbidden",capability_removed:"forbidden",claude_unavailable:"claude_unavailable",rate_limited:"rate_limited"},fr=t=>{const e=typeof t=="object"&&t!==null&&"code"in t?t.code:void 0;return(typeof e=="string"?ur[e]:void 0)??"error"},gr={too_large:"handoffTooLarge",consent:"handoffConsent",forbidden:"handoffForbidden",claude_unavailable:"handoffClaudeUnavailable",rate_limited:"handoffRateLimited",storage:"handoffStorage",error:"handoffError"},Ge=(t,e)=>G(e)[gr[t]],an=t=>t.group?`${t.group} \xB7 ${t.label}`:t.label,dn=(t,e)=>{const{definition:n,state:s,navigation:r,derivation:i}=t,o=nn(t.locale),l=n.currentTarget?.(s,r)??null,a=e.attachment,d=a.kind==="explicit"?n.commentTargets(s,r).find(h=>h.value===a.ref):null,p=a.kind==="explicit"?{ref:a.ref,label:d?an(d):a.ref}:a.kind==="current"&&l?{ref:l.value,label:an(l)}:{ref:`page:${n.name}`,label:o.wholePage},c=new Map(i.stale.map(h=>[h.action.id,h.reason]));return{body:e.body,target:p,attachment:a.kind==="explicit"?{kind:"explicit"}:l?{kind:"checkbox",checked:a.kind==="current",group:l.group??""}:{kind:"none"},canSubmit:e.body.trim().length>0,items:i.actions.map(h=>{const u=n.describe(h,s,i.base),v=h.type==="comment";return{id:h.id,title:v?o.comment:u.title,targetLabel:u.targetLabel,tone:v?"comment":u.tone,text:{kind:v?"comment":"summary",body:v?xe(h):u.summary??""},code:n.serialize(h),stale:c.get(h.id)??null}}),issues:t.issues.map(h=>`${h.path?`${h.path}: `:""}${h.message}`),send:t.sendable!==!0?"hidden":i.actions.length===0||e.send.kind==="pending"?"disabled":"ready",flash:e.send.kind==="sent"?o.sent:e.send.kind==="failed"?Ge(e.send.reason,t.locale):e.copy.kind==="copied"?o.copied:e.copy.kind==="failed"?o.copyFailed:""}},mr=[fe,ge,R`
|
|
523
523
|
:host {
|
|
524
524
|
display: flex;
|
|
525
525
|
flex-direction: column;
|
|
@@ -875,7 +875,7 @@ The brief is too long for a comment, so it is stored in this artifact's database
|
|
|
875
875
|
letter-spacing: 0.04em;
|
|
876
876
|
color: var(--dpk-green);
|
|
877
877
|
}
|
|
878
|
-
`],vr={CHILD:2},
|
|
878
|
+
`],vr={CHILD:2},ln=t=>(...e)=>({_$litDirective$:t,values:e});let cn=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,n,s){this._$Ct=e,this._$AM=n,this._$Ci=s}_$AS(e,n){return this.update(e,n)}update(e,n){return this.render(...n)}};const{I:br}=vs,pn=t=>t,hn=()=>document.createComment(""),re=(t,e,n)=>{const s=t._$AA.parentNode,r=e===void 0?t._$AB:e._$AA;if(n===void 0){const i=s.insertBefore(hn(),r),o=s.insertBefore(hn(),r);n=new br(i,o,t,t.options)}else{const i=n._$AB.nextSibling,o=n._$AM,l=o!==t;if(l){let a;n._$AQ?.(t),n._$AM=t,n._$AP!==void 0&&(a=t._$AU)!==o._$AU&&n._$AP(a)}if(i!==r||l){let a=n._$AA;for(;a!==i;){const d=pn(a).nextSibling;pn(s).insertBefore(a,r),a=d}}}return n},z=(t,e,n=t)=>(t._$AI(e,n),t),kr={},un=(t,e=kr)=>t._$AH=e,yr=t=>t._$AH,Ze=t=>{t._$AR(),t._$AA.remove()},fn=(t,e,n)=>{const s=new Map;for(let r=e;r<=n;r++)s.set(t[r],r);return s},gn=ln(class extends cn{constructor(t){if(super(t),t.type!==vr.CHILD)throw Error("repeat() can only be used in text expressions")}dt(t,e,n){let s;n===void 0?n=e:e!==void 0&&(s=e);const r=[],i=[];let o=0;for(const l of t)r[o]=s?s(l,o):o,i[o]=n(l,o),o++;return{values:i,keys:r}}render(t,e,n){return this.dt(t,e,n).values}update(t,[e,n,s]){const r=yr(t),{values:i,keys:o}=this.dt(e,n,s);if(!Array.isArray(r))return this.ut=o,i;const l=this.ut??=[],a=[];let d,p,c=0,h=r.length-1,u=0,v=i.length-1;for(;c<=h&&u<=v;)if(r[c]===null)c++;else if(r[h]===null)h--;else if(l[c]===o[u])a[u]=z(r[c],i[u]),c++,u++;else if(l[h]===o[v])a[v]=z(r[h],i[v]),h--,v--;else if(l[c]===o[v])a[v]=z(r[c],i[v]),re(t,a[v+1],r[c]),c++,v--;else if(l[h]===o[u])a[u]=z(r[h],i[u]),re(t,r[c],r[h]),h--,u++;else if(d===void 0&&(d=fn(o,u,v),p=fn(l,c,h)),d.has(l[c]))if(d.has(l[h])){const C=p.get(o[u]),A=C!==void 0?r[C]:null;if(A===null){const j=re(t,r[c]);z(j,i[u]),a[u]=j}else a[u]=z(A,i[u]),re(t,r[c],A),r[C]=null;u++}else Ze(r[h]),h--;else Ze(r[c]),c++;for(;u<=v;){const C=re(t,a[v+1]);z(C,i[u]),a[u++]=C}for(;c<=h;){const C=r[c++];C!==null&&Ze(C)}return this.ut=o,un(t,a),P}}),Qe=()=>f`<svg
|
|
879
879
|
viewBox="0 0 16 16"
|
|
880
880
|
fill="none"
|
|
881
881
|
stroke="currentColor"
|
|
@@ -886,7 +886,7 @@ The brief is too long for a comment, so it is stored in this artifact's database
|
|
|
886
886
|
focusable="false"
|
|
887
887
|
>
|
|
888
888
|
<path d="M4 4l8 8M12 4l-8 8" />
|
|
889
|
-
</svg>`,
|
|
889
|
+
</svg>`,mn=()=>f`<svg
|
|
890
890
|
viewBox="0 0 16 16"
|
|
891
891
|
fill="none"
|
|
892
892
|
stroke="currentColor"
|
|
@@ -899,7 +899,7 @@ The brief is too long for a comment, so it is stored in this artifact's database
|
|
|
899
899
|
<path d="M3.5 5h9M5.5 5V3.5a1 1 0 011-1h3a1 1 0 011 1V5" />
|
|
900
900
|
<path d="M5 5l.5 7.5h5L11 5" />
|
|
901
901
|
<path d="M6.8 7.5v3.5M9.2 7.5v3.5" />
|
|
902
|
-
</svg>`,
|
|
902
|
+
</svg>`,vn=()=>f`<svg
|
|
903
903
|
viewBox="0 0 16 16"
|
|
904
904
|
fill="none"
|
|
905
905
|
stroke="currentColor"
|
|
@@ -910,7 +910,7 @@ The brief is too long for a comment, so it is stored in this artifact's database
|
|
|
910
910
|
focusable="false"
|
|
911
911
|
>
|
|
912
912
|
<path d="M3 13l1.5-1.5M11.3 2.7a1.5 1.5 0 012.1 2.1L5.5 12.7l-3 .8.8-3z" />
|
|
913
|
-
</svg>`,
|
|
913
|
+
</svg>`,Xe=()=>f`<svg
|
|
914
914
|
viewBox="0 0 16 16"
|
|
915
915
|
fill="none"
|
|
916
916
|
stroke="currentColor"
|
|
@@ -921,7 +921,7 @@ The brief is too long for a comment, so it is stored in this artifact's database
|
|
|
921
921
|
focusable="false"
|
|
922
922
|
>
|
|
923
923
|
<path d="M3.5 3.5h9a1 1 0 011 1v5a1 1 0 01-1 1H8.2l-2.7 2.2v-2.2H3.5a1 1 0 01-1-1v-5a1 1 0 011-1z" />
|
|
924
|
-
</svg>`,
|
|
924
|
+
</svg>`,bn=()=>f`<svg
|
|
925
925
|
viewBox="0 0 16 16"
|
|
926
926
|
fill="none"
|
|
927
927
|
stroke="currentColor"
|
|
@@ -957,7 +957,7 @@ The brief is too long for a comment, so it is stored in this artifact's database
|
|
|
957
957
|
focusable="false"
|
|
958
958
|
>
|
|
959
959
|
<path d="M3.5 8.5l3 3 6-7" />
|
|
960
|
-
</svg>`,
|
|
960
|
+
</svg>`,kn=()=>f`<svg
|
|
961
961
|
viewBox="0 0 16 16"
|
|
962
962
|
fill="none"
|
|
963
963
|
stroke="currentColor"
|
|
@@ -975,7 +975,7 @@ The brief is too long for a comment, so it is stored in this artifact's database
|
|
|
975
975
|
<circle cx="9.5" cy="8" r="1" />
|
|
976
976
|
<circle cx="6.5" cy="11.5" r="1" />
|
|
977
977
|
<circle cx="9.5" cy="11.5" r="1" />
|
|
978
|
-
</svg>`,
|
|
978
|
+
</svg>`,yn=()=>f`<svg
|
|
979
979
|
viewBox="0 0 16 16"
|
|
980
980
|
fill="none"
|
|
981
981
|
stroke="currentColor"
|
|
@@ -1079,7 +1079,7 @@ The brief is too long for a comment, so it is stored in this artifact's database
|
|
|
1079
1079
|
focusable="false"
|
|
1080
1080
|
>
|
|
1081
1081
|
<path d="M13.5 9.6A5.75 5.75 0 016.4 2.5a5.75 5.75 0 107.1 7.1z" />
|
|
1082
|
-
</svg>`,jr=t=>{switch(t){case"comment":return
|
|
1082
|
+
</svg>`,jr=t=>{switch(t){case"comment":return Xe();case"create":return kn();case"update":return vn();case"delete":return mn();case"move":return yn();default:return bn()}},Rr=(t,e,n,s=!1)=>f`
|
|
1083
1083
|
${s?m:f`<header><h2>${t.heading}</h2></header>`}
|
|
1084
1084
|
${e.issues.length>0?f`<div class="issues" role="alert">
|
|
1085
1085
|
<strong>${t.rejected}</strong>
|
|
@@ -1098,7 +1098,7 @@ The brief is too long for a comment, so it is stored in this artifact's database
|
|
|
1098
1098
|
></textarea>
|
|
1099
1099
|
${e.attachment.kind==="explicit"?f`<div class="row">
|
|
1100
1100
|
<button class="chip" type="button" aria-label=${t.detach} @click=${()=>n({kind:"clear-target"})}>
|
|
1101
|
-
${e.target.label} ${
|
|
1101
|
+
${e.target.label} ${Qe()}
|
|
1102
1102
|
</button>
|
|
1103
1103
|
</div>`:e.attachment.kind==="checkbox"?f`<div class="row">
|
|
1104
1104
|
<label class="attach">
|
|
@@ -1125,11 +1125,11 @@ The brief is too long for a comment, so it is stored in this artifact's database
|
|
|
1125
1125
|
<ul class="list">
|
|
1126
1126
|
${e.items.length===0?f`<li class="empty">
|
|
1127
1127
|
<div class="empty-box">
|
|
1128
|
-
${
|
|
1128
|
+
${Xe()}
|
|
1129
1129
|
<p>${t.empty}</p>
|
|
1130
1130
|
<p class="empty-hint">${t.emptyHint}</p>
|
|
1131
1131
|
</div>
|
|
1132
|
-
</li>`:
|
|
1132
|
+
</li>`:gn(e.items,r=>r.id,r=>Lr(t,r,n))}
|
|
1133
1133
|
</ul>
|
|
1134
1134
|
<footer>
|
|
1135
1135
|
${s||e.send==="hidden"?m:f`<button
|
|
@@ -1173,14 +1173,14 @@ The brief is too long for a comment, so it is stored in this artifact's database
|
|
|
1173
1173
|
aria-label=${t.deleteAction}
|
|
1174
1174
|
@click=${()=>n({kind:"delete",id:e.id})}
|
|
1175
1175
|
>
|
|
1176
|
-
${
|
|
1176
|
+
${Qe()}
|
|
1177
1177
|
</button>
|
|
1178
1178
|
</div>
|
|
1179
1179
|
<div class="item-target">${e.targetLabel}</div>
|
|
1180
1180
|
${e.text.kind==="comment"?f`<p class="item-body">${e.text.body}</p>`:e.text.body?f`<div class="item-summary">${e.text.body}</div>`:m}
|
|
1181
1181
|
<code class="item-code">${e.code}</code>
|
|
1182
1182
|
</li>
|
|
1183
|
-
`;class yn extends O{static{this.styles=mr}static{this.properties={definition:{attribute:!1},state:{attribute:!1},navigation:{attribute:!1},derivation:{attribute:!1},issues:{attribute:!1},pendingTarget:{attribute:!1},onDelete:{attribute:!1},onClear:{attribute:!1},onComment:{attribute:!1},exportBrief:{attribute:!1},sendToClaude:{attribute:!1},embedded:{type:Boolean}}}#e=rr();#r=new Le(this);constructor(){super(),this.embedded=!1,this.definition=null,this.state=void 0,this.navigation={},this.derivation=null,this.issues=[],this.pendingTarget=null}willUpdate(e){e.has("pendingTarget")&&this.pendingTarget&&(this.#e=sn(this.#e,{kind:"target-requested",ref:this.pendingTarget}))}updated(e){e.has("pendingTarget")&&this.pendingTarget&&this.isConnected&&this.renderRoot.querySelector("textarea")?.focus()}#s(){return!this.definition||!this.derivation?null:{definition:this.definition,state:this.state,navigation:this.navigation,derivation:this.derivation,issues:this.issues,sendable:this.sendToClaude!==void 0,locale:this.#r.locale}}render(){const e=this.#s();return e?Rr(tn(this.#r.locale),an(e,this.#e),this.#i,this.embedded):m}#t(e){this.#e=sn(this.#e,e),this.requestUpdate()}#i=e=>{switch(e.kind){case"delete":this.onDelete?.(e.id);return;case"clear":this.onClear?.();return;case"copy":this.#o();return;case"send":this.#n();return;case"submit":{const n=this.#s();if(!n||!this.onComment)return;const s=ir(this.#e,an(n,this.#e).target.ref);if(!s||!this.onComment(s.target,s.body).ok)return;this.#t({kind:"submitted"});return}default:this.#t(e)}};async#n(){const e=this.sendToClaude;if(!e||this.#e.send.kind==="pending")return;this.#t({kind:"send-started"});const n=this.#e.sendRequest,s=await e().catch(()=>({ok:!1,reason:"error"}));this.isConnected&&this.#t({kind:"send-finished",request:n,outcome:s})}async#o(){const e=this.#s();if(!e)return;this.#t({kind:"copy-started"});const n=this.#e.copyRequest;try{const s=this.exportBrief?.()??Ve({...e.derivation,navigation:e.navigation,issues:e.issues},e.definition,W),r=await We(s);this.isConnected&&this.#t({kind:"copy-finished",request:n,ok:r})}catch{this.isConnected&&this.#t({kind:"copy-finished",request:n,ok:!1})}}}const Nr=()=>{customElements.get("dpk-component-comment-panel")||customElements.define("dpk-component-comment-panel",yn)},Pr=$({value:g()}),Dr=t=>e=>{if(!(e instanceof CustomEvent))return;const n=y(Pr,e.detail);n.success&&t(n.output.value)},xn=t=>e=>{const n=te(e.target,HTMLSelectElement);n!==null&&t(n.value)},ie=t=>t==="light"||t==="dark"?t:null,wn=t=>t.authored??t.environment,$n=t=>t.preference??wn(t),Ur=t=>{const e=$n(t)==="dark"?"light":"dark";return e===wn(t)?null:e},An=q(K({value:b(g(),U(/^element:.+/)),label:b(g(),k(1)),group:S(g())})),qr=$({targets:An,providers:q($({id:b(g(),k(1)),results:q(Xt)}))}),Ir=K({target:b(g(),U(/^element:.+/)),body:b(g(),De(),k(1))}),Cn=t=>t.group?`${t.group} \xB7 ${t.label}`:t.label,Sn=(t,e,n)=>{const s=new Map(e.map(r=>[r.value,r]));return{...t,hasTarget:(r,i)=>t.hasTarget(r,i)||s.has(_(i)),commentTargets:(r,i)=>{const o=t.commentTargets(r,i),l=new Set(o.map(a=>a.value));return[...o,...e.filter(a=>!l.has(a.value))]},describe:(r,i,o)=>{if(T(r)){const d=n.get(r.id),p=s.get(_(r.target));return{title:d?.title??r.type,...d?.summary===void 0?{}:{summary:d.summary},tone:d?.tone??"update",targetLabel:p?Cn(p):r.target.id}}const l=t.describe(r,i,o),a=r.type==="comment"&&!t.hasTarget(i,r.target)?s.get(_(r.target)):void 0;return a===void 0?l:{...l,targetLabel:Cn(a)}},serialize:r=>T(r)?`${r.type} ${_(r.target)} ${JSON.stringify(r.payload)}`:t.serialize(r)}},_n=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})();function En(t){return typeof _n.Buffer<"u"&&_n.Buffer.isBuffer(t)}function Tn(t){if(!t||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);return e===null||e===Object.prototype||Object.getPrototypeOf(e)===null?Object.prototype.toString.call(t)==="[object Object]":!1}function Mn(t){return Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}function On(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const zr="[object RegExp]",Br="[object String]",Hr="[object Number]",Fr="[object Boolean]",Kr="[object Symbol]",Jr="[object Date]",Vr="[object Map]",Wr="[object Set]",Yr="[object Array]",Gr="[object Function]",Zr="[object ArrayBuffer]",Xe="[object Object]",Qr="[object Error]",Xr="[object DataView]",ei="[object Uint8Array]",ti="[object Uint8ClampedArray]",ni="[object Uint16Array]",si="[object Uint32Array]",ri="[object BigUint64Array]",ii="[object Int8Array]",oi="[object Int16Array]",ai="[object Int32Array]",di="[object BigInt64Array]",li="[object Float32Array]",ci="[object Float64Array]";function pi(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}function hi(t,e,n){return oe(t,e,void 0,void 0,void 0,void 0,n)}function oe(t,e,n,s,r,i,o){const l=o(t,e,n,s,r,i);if(l!==void 0)return l;if(typeof t==typeof e)switch(typeof t){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return t===e;case"number":return t===e||Object.is(t,e);case"function":return t===e;case"object":return ae(t,e,i,o)}return ae(t,e,i,o)}function ae(t,e,n,s){if(Object.is(t,e))return!0;let r=On(t),i=On(e);if(r==="[object Arguments]"&&(r=Xe),i==="[object Arguments]"&&(i=Xe),r!==i)return!1;switch(r){case Br:return t.toString()===e.toString();case Hr:return pi(t.valueOf(),e.valueOf());case Fr:case Jr:case Kr:return Object.is(t.valueOf(),e.valueOf());case zr:return t.source===e.source&&t.flags===e.flags;case Gr:return t===e}n=n??new Map;const o=n.get(t),l=n.get(e);if(o!=null&&l!=null)return o===e;n.set(t,e),n.set(e,t);try{switch(r){case Vr:if(t.size!==e.size)return!1;for(const[a,d]of t.entries())if(!e.has(a)||!oe(d,e.get(a),a,t,e,n,s))return!1;return!0;case Wr:{if(t.size!==e.size)return!1;const a=Array.from(t.values()),d=Array.from(e.values());for(let p=0;p<a.length;p++){const c=a[p],h=d.findIndex(u=>oe(c,u,void 0,t,e,n,s));if(h===-1)return!1;d.splice(h,1)}return!0}case Yr:case ei:case ti:case ni:case si:case ri:case ii:case oi:case ai:case di:case li:case ci:if(En(t)!==En(e)||t.length!==e.length)return!1;for(let a=0;a<t.length;a++)if(!oe(t[a],e[a],a,t,e,n,s))return!1;return!0;case Zr:return t.byteLength!==e.byteLength?!1:ae(new Uint8Array(t),new Uint8Array(e),n,s);case Xr:return t.byteLength!==e.byteLength||t.byteOffset!==e.byteOffset?!1:ae(new Uint8Array(t),new Uint8Array(e),n,s);case Qr:return t.name===e.name&&t.message===e.message;case Xe:{if(!(ae(t.constructor,e.constructor,n,s)||Tn(t)&&Tn(e)))return!1;const a=[...Object.keys(t),...Mn(t)],d=[...Object.keys(e),...Mn(e)];if(a.length!==d.length)return!1;for(let p=0;p<a.length;p++){const c=a[p],h=t[c];if(!Object.hasOwn(e,c))return!1;const u=e[c];if(!oe(h,u,c,t,e,n,s))return!1}return!0}default:return!1}}finally{n.delete(t),n.delete(e)}}function ui(){}function we(t,e){return hi(t,e,ui)}const jn="page",Rn=t=>_(t),Ln=(t,e,n,s=new Map)=>{let r=e;const i=[],o=[],l=[],a=[],d=new Map;for(const c of n){if(c.type===E)continue;if(T(c)){const v=s.get(c.id);v===void 0||v.stale!==void 0?o.push({action:c,reason:v?.stale??"target-missing"}):i.push(c);continue}const h=ye(t.actions,c.type);if(!h){o.push({action:c,reason:"unsupported-action-type"});continue}const u=t.apply(r,c);if(u===null){o.push({action:c,reason:t.hasTarget(r,c.target)?"constraint-violated":"target-missing"});continue}if(h.mode!=="append"&&et(t,r,u)){l.push(c);continue}r=u,i.push(c)}for(const c of n){if(c.type!==E)continue;if(c.target.type!==jn&&!t.hasTarget(r,c.target)){o.push({action:c,reason:"target-missing"});continue}a.push(c);const h=Rn(c.target);d.set(h,[...d.get(h)??[],c])}const p=new Map(n.map((c,h)=>[c.id,h]));return o.sort((c,h)=>(p.get(c.action.id)??0)-(p.get(h.action.id)??0)),{base:e,state:r,actions:n,applied:i,stale:o,obsolete:l,comments:a,commentsByTarget:d}},et=(t,e,n)=>e===n?!0:t.canonicalState===void 0?we(e,n):we(t.canonicalState(e),t.canonicalState(n)),Nn=t=>{const e=new Set(t.obsolete.map(n=>n.id));return t.actions.filter(n=>!e.has(n.id))},fi=(t,e,n,s)=>{let r=e;const i=s??Pn(r).map(o=>o.id);for(const o of[...i].reverse())r=gi(t,r,n,o,s!==void 0)??r;return r},Pn=t=>t.applied.filter(e=>!T(e)),gi=(t,e,n,s,r)=>{const i=Pn(e),o=i.findIndex(h=>h.id===s),l=i[o];if(l===void 0)return null;const a=i.slice(0,o),d=[...r?mi(t,e.base,i,o):[],...vi(t,a,l)],p=new Set,c=d.filter(h=>{const u=h.join(" ");return p.has(u)?!1:(p.add(u),!0)}).sort((h,u)=>u.length-h.length);for(const h of c){const u=bi(t,e,n,h);if(u!==null)return u}return null},mi=(t,e,n,s)=>{const r=[];let i=e;for(const o of n.slice(0,s+1))r.push(i),i=t.apply(i,o)??i;return r.flatMap((o,l)=>et(t,o,i)?[n.slice(l,s+1).map(a=>a.id)]:[])},vi=(t,e,n)=>{const s=Dn(n),r=e.filter(a=>Dn(a).some(d=>s.includes(d))),i=Un(t,n),o=r.filter(a=>Un(t,a)===i),l=a=>a.map((d,p)=>[...a.slice(p).map(c=>c.id),n.id]);return[...l(r),...l(o),...r.map(a=>[a.id,n.id]),...r.map(a=>[a.id])]},Dn=t=>{const e=t.target.type===jn?[]:t.target.id.split("."),n=typeof t.payload=="object"&&t.payload!==null?Object.values(t.payload).filter(s=>typeof s=="string"&&s!==""):[];return[...e,...n]},Un=(t,e)=>ye(t.actions,e.type)?.mode,bi=(t,e,n,s)=>{const r=new Set(e.stale.map(o=>o.action.id)),i=new Set(s);for(;;){const o=n(e.actions.filter(a=>!i.has(a.id))),l=o.stale.filter(a=>!r.has(a.action.id)).map(a=>a.action);if(l.length===0)return et(t,o.state,e.state)?o:null;if(l.some(a=>a.type===E||T(a)))return null;for(const a of l)i.add(a.id)}},ki=$({v:F(1),template:b(g(),k(1)),actions:q(I())});class tt{constructor(e){this.storage=e}load(e,n){try{const s=this.storage.getItem(e);if(s===null)return[];const r=y(ki,JSON.parse(s));return!r.success||r.output.template!==n?[]:r.output.actions.flatMap(i=>{const o=y(J,i);return o.success?[o.output]:[]})}catch{return[]}}save(e,n,s){const r={v:1,template:n,actions:s};try{this.storage.setItem(e,JSON.stringify(r))}catch{}}clear(e){try{this.storage.removeItem(e)}catch{}}}class nt{constructor(){this.store=new Map}load(e,n){return new tt({getItem:s=>this.store.get(s)??null,setItem:(s,r)=>{this.store.set(s,r)},removeItem:s=>{this.store.delete(s)}}).load(e,n)}save(e,n,s){this.store.set(e,JSON.stringify({v:1,template:n,actions:s}))}clear(e){this.store.delete(e)}}const st=()=>{try{if(typeof localStorage<"u")return new tt(localStorage)}catch{}return new nt},qn=t=>`dev-process-kit:draft:${typeof location>"u"?"local":`${location.pathname}${location.search}`}:${t}`,yi=q(I());class In{#e;#r;#s={targets:[],providers:[]};#t=new Map;#i;#n;#o;#a;#d;#p=new Set;#m=[];#f=0;constructor(e){this.#e=e.definition,this.#r=Sn(e.definition,[],this.#t),this.#i=e.base,this.#d=e.storageKey??qn(e.definition.name),this.#a=e.storage===void 0?st():e.storage;const n=e.initialActions??this.#a?.load(this.#d,this.definition.name)??[];this.#n=Bn(this.definition,n),this.#o=this.#l(this.#n),this.#w()&&this.#y()}get definition(){return this.#r}setComponentSnapshot(e){const n=Ft(qr,e);if(!we(n,this.#s)){this.#s=n,this.#g(),this.#o=this.#l(this.#n);for(const s of this.#p)s()}}setTemplate(e){this.#e=e,this.#g(),this.#o=this.#l(this.#n);for(const n of this.#p)n()}#g(){this.#t=en(this.#n,this.#s.providers),this.#r=Sn(this.#e,this.#s.targets,this.#t)}#l(e){return Ln(this.definition,this.#i,e,en(e,this.#s.providers))}get base(){return this.#i}get actions(){return this.#n}get derivation(){return this.#o}get lastIssues(){return this.#m}get prunedCount(){return this.#f}descriptorFor(e,n){return zn(this.definition,e,n)}dispatch(e){const n=this.#v(e,this.#o.state);if(!n.ok)return this.#c([n.issue]);const s=this.descriptorFor(n.action.type,n.action.target);return s?(this.#h(Ie(this.#n,n.action,s),[n.action.id]),{ok:!0,id:n.action.id}):this.#c([{path:"type",message:"unknown action type"}])}dispatchBatch(e){const n=y(yi,e);if(!n.success)return this.#c([se(n.issues)]);const s=n.output;if(s.length===0)return{ok:!0,ids:[]};let r=this.#n,i=this.#o.state;const o=[];for(const l of s){const a=this.#v(l,i);if(!a.ok)return this.#c([a.issue]);const d=a.action,p=this.descriptorFor(d.type,d.target);if(!p)return this.#c([{path:"type",message:"unknown action type"}]);if((d.type==="comment"||T(d)?d.target.type==="page"||this.definition.hasTarget(i,d.target)?i:null:this.definition.apply(i,d))===null)return this.#c([{path:"target",message:"batch action is not applicable"}]);r=Ie(r,d,p),i=this.#l(r).state,o.push(d.id)}return this.#h(r,o),{ok:!0,ids:o}}#v(e,n){const s=y(Wt,e);if(!s.success)return{ok:!1,issue:se(s.issues)};const r=this.descriptorFor(s.output.type,typeof s.output.target=="string"?Ue(s.output.target,"page"):s.output.target);if(!r)return{ok:!1,issue:{path:"type",message:`unknown action type "${s.output.type}"`}};const i=Ws(s.output,r);if(!i.ok)return i;const o=this.definition.canonicalTarget?.(n,i.action.target)??i.action.target;return{ok:!0,action:{...i.action,target:o}}}#c(e){return this.#m=e,{ok:!1,issues:e}}removeAction(e){const n=this.#n.filter(s=>s.id!==e);n.length!==this.#n.length&&this.#h(n)}clearActions(){this.#n.length>0&&this.#h([])}replaceActions(e){this.#h(Bn(this.definition,e))}setBase(e){this.#i=e,this.#h(this.#n)}subscribe(e){return this.#p.add(e),()=>{this.#p.delete(e)}}exportDraft(e){return{template:this.definition.name,frameworkVersion:e,exportedAt:new Date().toISOString(),actions:this.#n}}#h(e,n){this.#m=[],this.#n=e,this.#g(),this.#o=this.#l(this.#n),this.#w(n),this.#y();for(const s of this.#p)s()}#w(e){const n=this.#k(),s=fi(this.definition,this.#o,r=>this.#l(r),e);return s===this.#o?n:(this.#f+=this.#n.length-s.actions.length,this.#n=[...s.actions],this.#g(),this.#o=this.#l(this.#n),this.#k(),!0)}#k(){return this.#o.obsolete.length===0?!1:(this.#f+=this.#o.obsolete.length,this.#n=Nn(this.#o),this.#g(),this.#o=this.#l(this.#n),!0)}#y(){this.#a?.save(this.#d,this.definition.name,this.#n)}}const zn=(t,e,n)=>e==="comment"?Gt:n!==void 0&&T({type:e,target:n})?Xs:ye(t.actions,e),Bn=(t,e)=>e.flatMap(n=>{const s=y(J,n);if(!s.success)return[];const r=s.output,i=zn(t,r.type,r.target);if(!i)return[];const o=y(i.schema,r);if(!o.success)return[];const l=y(J,o.output);return l.success?[l.output]:[]}),xi=()=>({status:{kind:"idle"},request:0}),wi=(t,e)=>{switch(e.kind){case"copy-started":return{status:{kind:"copying"},request:t.request+1};case"send-started":return{status:{kind:"sending"},request:t.request+1};case"copy-finished":return e.request!==t.request||t.status.kind!=="copying"?t:{...t,status:{kind:e.ok?"copied":"copy-failed"}};case"send-finished":return e.request!==t.request||t.status.kind!=="sending"?t:{...t,status:e.outcome.ok?{kind:"sent"}:{kind:"send-failed",reason:e.outcome.reason}};case"settled":return e.request===t.request?{...t,status:{kind:"idle"}}:t}},$i=(t,e)=>{if(t.actions===0||t.railOpen)return null;const n=Y(t.locale),s=e.status;return{send:t.sendable?{label:s.kind==="sending"?n.handoffSending:s.kind==="sent"?n.handoffSent:n.handoffSend,disabled:s.kind==="sending"}:null,copy:s.kind==="copied"?{label:n.handoffCopied,status:"copied"}:s.kind==="copy-failed"?{label:n.handoffCopyFailed,status:"failed"}:{label:n.handoffCopy,status:"idle"},note:s.kind==="send-failed"?Ye(s.reason,t.locale):null}},Hn=t=>{const e=t.derivation();return{base:e.base,state:e.state,navigation:t.navigation(),actions:t.controller().actions,comments:e.comments,stale:e.stale,issues:t.issues()}},Ai=t=>{const e=t.derivation();return{state:e.state,base:e.base,navigation:t.navigation(),actions:t.controller().actions,comments:e.comments,stale:e.stale,commentCount:n=>{const s=typeof n=="string"?n:_(n);return e.commentsByTarget.get(s)?.length??0},dispatch:n=>t.dispatch(n),dispatchBatch:n=>t.dispatchBatch(n),navigate:(n,s)=>t.navigate(n,s),hashFor:n=>t.hashFor(n),requestComment:n=>t.requestComment(n)}},Ci=(t,e)=>{const n=()=>Hn(t);return{version:W,template:t.definition.name,host:e,ready:t.ready,get base(){return t.controller().base},get state(){return t.derivation().state},get navigation(){return t.navigation()},get actions(){return t.controller().actions},get comments(){return t.derivation().comments},get stale(){return t.derivation().stale},get issues(){return t.issues()},dispatch:s=>t.dispatch(s),dispatchBatch:s=>t.dispatchBatch(s),comment:(s,r)=>t.dispatch({type:E,target:s,payload:{body:r}}),removeAction:s=>t.removeAction(s),clearActions:()=>t.clearActions(),importDraft:s=>t.controller().replaceActions(s),navigate:(s,r)=>t.navigate(s,r),hashFor:s=>t.hashFor(s),snapshot:n,exportDraft:()=>t.controller().exportDraft(W),exportBrief:()=>Ve(n(),t.controller().definition,W),subscribe:s=>t.subscribe(s)}},rt=(t,e)=>typeof t=="object"&&t!==null&&e.every(n=>typeof Reflect.get(t,n)=="function"),Si=t=>rt(t,["use"]),_i=t=>rt(t,["anchorFor","canSendToClaude","sendToClaude"]),Ei=t=>rt(t,["collection"]),Fn=async(t,e)=>{try{return await t.use(e)}catch{return null}},Ti=(t,e)=>({async canSend(){try{return await t.canSendToClaude()==="available"}catch{return!1}},async send({brief:n,draft:s,anchor:r}){let i=pr(n);if(i===null){if(e===null)return{ok:!1,reason:"too_large"};try{const o=e.collection(dr).doc();await o.set({brief:n,draft:s,createdAt:new Date().toISOString()}),i=hr(o.path)}catch{return{ok:!1,reason:"storage"}}}try{return await t.sendToClaude({anchor:await t.anchorFor(r),text:i}),{ok:!0}}catch(o){return{ok:!1,reason:fr(o)}}}}),Mi=async t=>{if(!Si(t))return null;const[e,n]=await Promise.all([Fn(t,"comments"),Fn(t,"db")]);return _i(e)?Ti(e,Ei(n)?n:null):null},Oi=()=>Reflect.get(globalThis,"claude");class ji{#e;#r;#s=null;#t=!1;constructor(e,n=Oi){this.#e=e,this.#r=n,e.addController(this)}get available(){return this.#t}hostConnected(){this.#s??=Mi(this.#r()),this.#i(),window.addEventListener("focus",this.#i)}hostDisconnected(){window.removeEventListener("focus",this.#i)}async send(e){const n=await this.#s;if(!n)return{ok:!1,reason:"forbidden"};const s=await n.send(e);return this.#i(),s}#i=async()=>{const e=await this.#s,n=e?await e.canSend():!1;n!==this.#t&&(this.#t=n,this.#e.requestUpdate())}}const Kn=(t,e)=>({read(n){try{const s=t.getItem(n);return s===null?null:e(JSON.parse(s))}catch{return null}},write(n,s){try{return t.setItem(n,JSON.stringify(s)),!0}catch{return!1}},remove(n){try{t.removeItem(n)}catch{}}}),it=t=>{const e=new Map;return Kn({getItem:n=>e.get(n)??null,setItem:(n,s)=>{e.set(n,s)},removeItem:n=>{e.delete(n)}},t)},Jn=t=>{try{if(typeof localStorage<"u")return Kn(localStorage,t)}catch{}return it(t)},ot="dev-process-kit:color-scheme",Ri="(prefers-color-scheme: dark)",Vn=()=>typeof matchMedia=="function"?matchMedia(Ri):null,Wn=()=>ie(document.documentElement.dataset.theme)??(Vn()?.matches===!0?"dark":"light");class Li{#e;#r;#s=null;#t=null;#i="light";#n=null;#o=null;constructor(e,n){this.#e=e,this.#r=n,e.addController(this)}hostConnected(){this.#s===null&&(this.#s=this.#r()?Jn(ie):it(ie),this.#t=this.#s.read(ot)),this.#i=Wn(),this.#n=Vn(),this.#n?.addEventListener("change",this.#d),this.#o=new MutationObserver(this.#d),this.#o.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})}hostDisconnected(){this.#n?.removeEventListener("change",this.#d),this.#n=null,this.#o?.disconnect(),this.#o=null}resolve(e){return $n(this.#a(e))}toggle(e){this.#t=Ur(this.#a(e)),this.#t===null?this.#s?.remove(ot):this.#s?.write(ot,this.#t),this.#e.requestUpdate()}#a(e){return{preference:this.#t,authored:e,environment:this.#i}}#d=()=>{const e=Wn();e!==this.#i&&(this.#i=e,this.#e.requestUpdate())}}const Ni=(t,e)=>{const n=[],s=r=>{(r===t||r instanceof ShadowRoot)&&e?.(r);for(const i of r.children)i.hasAttribute("data-template")||(("commentTargets"in i||"elementActions"in i)&&n.push(i),s(i),i.shadowRoot&&s(i.shadowRoot))};return s(t),n},Yn=(t,e)=>{const n=new Map;for(const s of t)n.set(e(s),(n.get(e(s))??0)+1);return t.filter(s=>n.get(e(s))===1)},Gn=t=>Yn(t.filter(e=>"elementActions"in e&&e.id.length>0),e=>e.id),Zn=(t,e)=>{for(const n of Gn(t)){const s=tr(e,n.id),r=Reflect.get(n,"elementActions");Array.isArray(r)&&r.length===s.length&&s.every((o,l)=>{const a=r[l];return typeof a=="object"&&a!==null&&"id"in a&&a.id===o.id})||Reflect.set(n,"elementActions",s)}},Pi=t=>{const e=Reflect.get(t,"elementActionResults");return Array.isArray(e)?e.flatMap(n=>{const s=y(Xt,n);return s.success?[s.output]:[]}):[]},Di=t=>{const e=[];for(const n of t){if(!("commentTargets"in n))continue;const s=y(An,n.commentTargets);s.success&&e.push(...s.output)}return{targets:Yn(e,n=>n.value),providers:Gn(t).map(n=>({id:n.id,results:Pi(n)}))}},Ui=2400;class qi{#e=xi();#r=null;#s;constructor(e){this.#s=e,e.addController(this)}get state(){return this.#e}hostDisconnected(){this.#n()}async copy(e){this.#t({kind:"copy-started"});const n=this.#e.request,s=await We(e()).catch(()=>!1);this.#t({kind:"copy-finished",request:n,ok:s}),this.#i(n)}async send(e){if(this.#e.status.kind==="sending")return;this.#t({kind:"send-started"});const n=this.#e.request,s=await e().catch(()=>({ok:!1,reason:"error"}));this.#t({kind:"send-finished",request:n,outcome:s}),s.ok&&this.#i(n)}#t(e){(e.kind==="copy-started"||e.kind==="send-started")&&this.#n(),this.#e=wi(this.#e,e),this.#s.requestUpdate()}#i(e){e===this.#e.request&&(this.#n(),this.#r=setTimeout(()=>{this.#r=null,this.#t({kind:"settled",request:e})},Ui))}#n(){this.#r!==null&&clearTimeout(this.#r),this.#r=null}}const at="dev-process-kit:locale";class Ii{#e;#r;#s;#t=null;#i=null;#n;#o;constructor(e,n,s){this.#e=e,this.#r=n,this.#s=s,e.addController(this)}get authored(){if(this.#n===void 0)return je(Me(this.#e));const e=this.#e.parentNode;return je(this.#n??(e===null?null:Me(e)))}get locale(){return this.#o??this.#a()}#a(){return xs({preference:this.#i,authored:this.authored})}hostConnected(){this.#t===null&&(this.#t=this.#r()?Jn(Mt):it(Mt),this.#i=this.#t.read(at)),this.#n??=this.#e.getAttribute("lang"),this.#d()}pick(e){this.#i=ws(e,this.authored),this.#i===null?this.#t?.remove(at):this.#t?.write(at,this.#i),this.#d(),this.#e.requestUpdate()}#d(){const e=this.#i??this.#n??null;e===null?this.#e.removeAttribute("lang"):this.#e.getAttribute("lang")!==e&&this.#e.setAttribute("lang",e);const n=this.#a();if(n===this.#o)return;const s=this.#o===void 0;this.#o=n,this.#s(),(!s||this.#i!==null)&&document.dispatchEvent(new Event(Re))}}const Qn=()=>Ke(typeof location>"u"?"":location.hash),zi=(t,e)=>{if(typeof history>"u")return;const n=`${location.pathname}${location.search}${V(t)}`;`${location.pathname}${location.search}${location.hash}`!==n&&(e?history.replaceState(null,"",n):history.pushState(null,"",n))};class Bi{#e;#r=null;#s=0;constructor(e){this.#e=e}get orphans(){return this.#s}route(){const e=this.#e.renderRoot,n=te(e.querySelector('slot[name="preview"]'),HTMLSlotElement);if(n===null)return;this.#r!==n&&(this.#r=n,n.addEventListener("slotchange",this.#t));const s=new Set(Array.from(e.querySelectorAll("slot")).map(i=>i.getAttribute("name")??"")),r=n.assignedElements();for(const i of r){const o=i.getAttribute("data-preview-id");if(!o)continue;const l=`preview:${o}`;i.getAttribute("slot")!==l&&s.has(l)&&i.setAttribute("slot",l)}r.length!==this.#s&&(this.#s=r.length,queueMicrotask(()=>this.#e.requestUpdate()))}#t=()=>{queueMicrotask(()=>this.route())}}const Hi=[fe,ge,R`
|
|
1183
|
+
`;class xn extends O{static{this.styles=mr}static{this.properties={definition:{attribute:!1},state:{attribute:!1},navigation:{attribute:!1},derivation:{attribute:!1},issues:{attribute:!1},pendingTarget:{attribute:!1},onDelete:{attribute:!1},onClear:{attribute:!1},onComment:{attribute:!1},exportBrief:{attribute:!1},sendToClaude:{attribute:!1},embedded:{type:Boolean}}}#e=rr();#r=new Ne(this);constructor(){super(),this.embedded=!1,this.definition=null,this.state=void 0,this.navigation={},this.derivation=null,this.issues=[],this.pendingTarget=null}willUpdate(e){e.has("pendingTarget")&&this.pendingTarget&&(this.#e=rn(this.#e,{kind:"target-requested",ref:this.pendingTarget}))}updated(e){e.has("pendingTarget")&&this.pendingTarget&&this.isConnected&&this.renderRoot.querySelector("textarea")?.focus()}#s(){return!this.definition||!this.derivation?null:{definition:this.definition,state:this.state,navigation:this.navigation,derivation:this.derivation,issues:this.issues,sendable:this.sendToClaude!==void 0,locale:this.#r.locale}}render(){const e=this.#s();return e?Rr(nn(this.#r.locale),dn(e,this.#e),this.#i,this.embedded):m}#t(e){this.#e=rn(this.#e,e),this.requestUpdate()}#i=e=>{switch(e.kind){case"delete":this.onDelete?.(e.id);return;case"clear":this.onClear?.();return;case"copy":this.#o();return;case"send":this.#n();return;case"submit":{const n=this.#s();if(!n||!this.onComment)return;const s=ir(this.#e,dn(n,this.#e).target.ref);if(!s||!this.onComment(s.target,s.body).ok)return;this.#t({kind:"submitted"});return}default:this.#t(e)}};async#n(){const e=this.sendToClaude;if(!e||this.#e.send.kind==="pending")return;this.#t({kind:"send-started"});const n=this.#e.sendRequest,s=await e().catch(()=>({ok:!1,reason:"error"}));this.isConnected&&this.#t({kind:"send-finished",request:n,outcome:s})}async#o(){const e=this.#s();if(!e)return;this.#t({kind:"copy-started"});const n=this.#e.copyRequest;try{const s=this.exportBrief?.()??We({...e.derivation,navigation:e.navigation,issues:e.issues},e.definition,Y),r=await Ye(s);this.isConnected&&this.#t({kind:"copy-finished",request:n,ok:r})}catch{this.isConnected&&this.#t({kind:"copy-finished",request:n,ok:!1})}}}const Nr=()=>{customElements.get("dpk-component-comment-panel")||customElements.define("dpk-component-comment-panel",xn)},Pr=$({value:g()}),Dr=t=>e=>{if(!(e instanceof CustomEvent))return;const n=y(Pr,e.detail);n.success&&t(n.output.value)},wn=t=>e=>{const n=F(e.target,HTMLSelectElement);n!==null&&t(n.value)},Ir=t=>e=>{const n=F(e.target,HTMLInputElement);n!==null&&t(n.checked)},ie=t=>t==="light"||t==="dark"?t:null,$n=t=>t.authored??t.environment,An=t=>t.preference??$n(t),Ur=t=>{const e=An(t)==="dark"?"light":"dark";return e===$n(t)?null:e},Cn=U(J({value:b(g(),I(/^element:.+/)),label:b(g(),k(1)),group:S(g())})),qr=$({targets:Cn,providers:U($({id:b(g(),k(1)),results:U(en)}))}),zr=J({target:b(g(),I(/^element:.+/)),body:b(g(),Ie(),k(1))}),Sn=t=>t.group?`${t.group} \xB7 ${t.label}`:t.label,_n=(t,e,n)=>{const s=new Map(e.map(r=>[r.value,r]));return{...t,hasTarget:(r,i)=>t.hasTarget(r,i)||s.has(_(i)),commentTargets:(r,i)=>{const o=t.commentTargets(r,i),l=new Set(o.map(a=>a.value));return[...o,...e.filter(a=>!l.has(a.value))]},describe:(r,i,o)=>{if(T(r)){const d=n.get(r.id),p=s.get(_(r.target));return{title:d?.title??r.type,...d?.summary===void 0?{}:{summary:d.summary},tone:d?.tone??"update",targetLabel:p?Sn(p):r.target.id}}const l=t.describe(r,i,o),a=r.type==="comment"&&!t.hasTarget(i,r.target)?s.get(_(r.target)):void 0;return a===void 0?l:{...l,targetLabel:Sn(a)}},serialize:r=>T(r)?`${r.type} ${_(r.target)} ${JSON.stringify(r.payload)}`:t.serialize(r)}},En=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})();function Tn(t){return typeof En.Buffer<"u"&&En.Buffer.isBuffer(t)}function Mn(t){if(!t||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);return e===null||e===Object.prototype||Object.getPrototypeOf(e)===null?Object.prototype.toString.call(t)==="[object Object]":!1}function On(t){return Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}function jn(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const Br="[object RegExp]",Hr="[object String]",Fr="[object Number]",Kr="[object Boolean]",Jr="[object Symbol]",Vr="[object Date]",Wr="[object Map]",Yr="[object Set]",Gr="[object Array]",Zr="[object Function]",Qr="[object ArrayBuffer]",et="[object Object]",Xr="[object Error]",ei="[object DataView]",ti="[object Uint8Array]",ni="[object Uint8ClampedArray]",si="[object Uint16Array]",ri="[object Uint32Array]",ii="[object BigUint64Array]",oi="[object Int8Array]",ai="[object Int16Array]",di="[object Int32Array]",li="[object BigInt64Array]",ci="[object Float32Array]",pi="[object Float64Array]";function hi(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}function ui(t,e,n){return oe(t,e,void 0,void 0,void 0,void 0,n)}function oe(t,e,n,s,r,i,o){const l=o(t,e,n,s,r,i);if(l!==void 0)return l;if(typeof t==typeof e)switch(typeof t){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return t===e;case"number":return t===e||Object.is(t,e);case"function":return t===e;case"object":return ae(t,e,i,o)}return ae(t,e,i,o)}function ae(t,e,n,s){if(Object.is(t,e))return!0;let r=jn(t),i=jn(e);if(r==="[object Arguments]"&&(r=et),i==="[object Arguments]"&&(i=et),r!==i)return!1;switch(r){case Hr:return t.toString()===e.toString();case Fr:return hi(t.valueOf(),e.valueOf());case Kr:case Vr:case Jr:return Object.is(t.valueOf(),e.valueOf());case Br:return t.source===e.source&&t.flags===e.flags;case Zr:return t===e}n=n??new Map;const o=n.get(t),l=n.get(e);if(o!=null&&l!=null)return o===e;n.set(t,e),n.set(e,t);try{switch(r){case Wr:if(t.size!==e.size)return!1;for(const[a,d]of t.entries())if(!e.has(a)||!oe(d,e.get(a),a,t,e,n,s))return!1;return!0;case Yr:{if(t.size!==e.size)return!1;const a=Array.from(t.values()),d=Array.from(e.values());for(let p=0;p<a.length;p++){const c=a[p],h=d.findIndex(u=>oe(c,u,void 0,t,e,n,s));if(h===-1)return!1;d.splice(h,1)}return!0}case Gr:case ti:case ni:case si:case ri:case ii:case oi:case ai:case di:case li:case ci:case pi:if(Tn(t)!==Tn(e)||t.length!==e.length)return!1;for(let a=0;a<t.length;a++)if(!oe(t[a],e[a],a,t,e,n,s))return!1;return!0;case Qr:return t.byteLength!==e.byteLength?!1:ae(new Uint8Array(t),new Uint8Array(e),n,s);case ei:return t.byteLength!==e.byteLength||t.byteOffset!==e.byteOffset?!1:ae(new Uint8Array(t),new Uint8Array(e),n,s);case Xr:return t.name===e.name&&t.message===e.message;case et:{if(!(ae(t.constructor,e.constructor,n,s)||Mn(t)&&Mn(e)))return!1;const a=[...Object.keys(t),...On(t)],d=[...Object.keys(e),...On(e)];if(a.length!==d.length)return!1;for(let p=0;p<a.length;p++){const c=a[p],h=t[c];if(!Object.hasOwn(e,c))return!1;const u=e[c];if(!oe(h,u,c,t,e,n,s))return!1}return!0}default:return!1}}finally{n.delete(t),n.delete(e)}}function fi(){}function we(t,e){return ui(t,e,fi)}const Rn="page",Ln=t=>_(t),Nn=(t,e,n,s=new Map)=>{let r=e;const i=[],o=[],l=[],a=[],d=new Map;for(const c of n){if(c.type===E)continue;if(T(c)){const v=s.get(c.id);v===void 0||v.stale!==void 0?o.push({action:c,reason:v?.stale??"target-missing"}):i.push(c);continue}const h=ye(t.actions,c.type);if(!h){o.push({action:c,reason:"unsupported-action-type"});continue}const u=t.apply(r,c);if(u===null){o.push({action:c,reason:t.hasTarget(r,c.target)?"constraint-violated":"target-missing"});continue}if(h.mode!=="append"&&tt(t,r,u)){l.push(c);continue}r=u,i.push(c)}for(const c of n){if(c.type!==E)continue;if(c.target.type!==Rn&&!t.hasTarget(r,c.target)){o.push({action:c,reason:"target-missing"});continue}a.push(c);const h=Ln(c.target);d.set(h,[...d.get(h)??[],c])}const p=new Map(n.map((c,h)=>[c.id,h]));return o.sort((c,h)=>(p.get(c.action.id)??0)-(p.get(h.action.id)??0)),{base:e,state:r,actions:n,applied:i,stale:o,obsolete:l,comments:a,commentsByTarget:d}},tt=(t,e,n)=>e===n?!0:t.canonicalState===void 0?we(e,n):we(t.canonicalState(e),t.canonicalState(n)),Pn=t=>{const e=new Set(t.obsolete.map(n=>n.id));return t.actions.filter(n=>!e.has(n.id))},gi=(t,e,n,s)=>{let r=e;const i=s??Dn(r).map(o=>o.id);for(const o of[...i].reverse())r=mi(t,r,n,o,s!==void 0)??r;return r},Dn=t=>t.applied.filter(e=>!T(e)),mi=(t,e,n,s,r)=>{const i=Dn(e),o=i.findIndex(h=>h.id===s),l=i[o];if(l===void 0)return null;const a=i.slice(0,o),d=[...r?vi(t,e.base,i,o):[],...bi(t,a,l)],p=new Set,c=d.filter(h=>{const u=h.join(" ");return p.has(u)?!1:(p.add(u),!0)}).sort((h,u)=>u.length-h.length);for(const h of c){const u=ki(t,e,n,h);if(u!==null)return u}return null},vi=(t,e,n,s)=>{const r=[];let i=e;for(const o of n.slice(0,s+1))r.push(i),i=t.apply(i,o)??i;return r.flatMap((o,l)=>tt(t,o,i)?[n.slice(l,s+1).map(a=>a.id)]:[])},bi=(t,e,n)=>{const s=In(n),r=e.filter(a=>In(a).some(d=>s.includes(d))),i=Un(t,n),o=r.filter(a=>Un(t,a)===i),l=a=>a.map((d,p)=>[...a.slice(p).map(c=>c.id),n.id]);return[...l(r),...l(o),...r.map(a=>[a.id,n.id]),...r.map(a=>[a.id])]},In=t=>{const e=t.target.type===Rn?[]:t.target.id.split("."),n=typeof t.payload=="object"&&t.payload!==null?Object.values(t.payload).filter(s=>typeof s=="string"&&s!==""):[];return[...e,...n]},Un=(t,e)=>ye(t.actions,e.type)?.mode,ki=(t,e,n,s)=>{const r=new Set(e.stale.map(o=>o.action.id)),i=new Set(s);for(;;){const o=n(e.actions.filter(a=>!i.has(a.id))),l=o.stale.filter(a=>!r.has(a.action.id)).map(a=>a.action);if(l.length===0)return tt(t,o.state,e.state)?o:null;if(l.some(a=>a.type===E||T(a)))return null;for(const a of l)i.add(a.id)}},yi=$({v:K(1),template:b(g(),k(1)),actions:U(q())});class nt{constructor(e){this.storage=e}load(e,n){try{const s=this.storage.getItem(e);if(s===null)return[];const r=y(yi,JSON.parse(s));return!r.success||r.output.template!==n?[]:r.output.actions.flatMap(i=>{const o=y(V,i);return o.success?[o.output]:[]})}catch{return[]}}save(e,n,s){const r={v:1,template:n,actions:s};try{this.storage.setItem(e,JSON.stringify(r))}catch{}}clear(e){try{this.storage.removeItem(e)}catch{}}}class st{constructor(){this.store=new Map}load(e,n){return new nt({getItem:s=>this.store.get(s)??null,setItem:(s,r)=>{this.store.set(s,r)},removeItem:s=>{this.store.delete(s)}}).load(e,n)}save(e,n,s){this.store.set(e,JSON.stringify({v:1,template:n,actions:s}))}clear(e){this.store.delete(e)}}const rt=()=>{try{if(typeof localStorage<"u")return new nt(localStorage)}catch{}return new st},qn=t=>`dev-process-kit:draft:${typeof location>"u"?"local":`${location.pathname}${location.search}`}:${t}`,xi=U(q());class zn{#e;#r;#s={targets:[],providers:[]};#t=new Map;#i;#n;#o;#a;#d;#p=new Set;#m=[];#f=0;constructor(e){this.#e=e.definition,this.#r=_n(e.definition,[],this.#t),this.#i=e.base,this.#d=e.storageKey??qn(e.definition.name),this.#a=e.storage===void 0?rt():e.storage;const n=e.initialActions??this.#a?.load(this.#d,this.definition.name)??[];this.#n=Hn(this.definition,n),this.#o=this.#l(this.#n),this.#w()&&this.#y()}get definition(){return this.#r}setComponentSnapshot(e){const n=Kt(qr,e);if(!we(n,this.#s)){this.#s=n,this.#g(),this.#o=this.#l(this.#n);for(const s of this.#p)s()}}setTemplate(e){this.#e=e,this.#g(),this.#o=this.#l(this.#n);for(const n of this.#p)n()}#g(){this.#t=tn(this.#n,this.#s.providers),this.#r=_n(this.#e,this.#s.targets,this.#t)}#l(e){return Nn(this.definition,this.#i,e,tn(e,this.#s.providers))}get base(){return this.#i}get actions(){return this.#n}get derivation(){return this.#o}get lastIssues(){return this.#m}get prunedCount(){return this.#f}descriptorFor(e,n){return Bn(this.definition,e,n)}dispatch(e){const n=this.#v(e,this.#o.state);if(!n.ok)return this.#c([n.issue]);const s=this.descriptorFor(n.action.type,n.action.target);return s?(this.#h(ze(this.#n,n.action,s),[n.action.id]),{ok:!0,id:n.action.id}):this.#c([{path:"type",message:"unknown action type"}])}dispatchBatch(e){const n=y(xi,e);if(!n.success)return this.#c([se(n.issues)]);const s=n.output;if(s.length===0)return{ok:!0,ids:[]};let r=this.#n,i=this.#o.state;const o=[];for(const l of s){const a=this.#v(l,i);if(!a.ok)return this.#c([a.issue]);const d=a.action,p=this.descriptorFor(d.type,d.target);if(!p)return this.#c([{path:"type",message:"unknown action type"}]);if((d.type==="comment"||T(d)?d.target.type==="page"||this.definition.hasTarget(i,d.target)?i:null:this.definition.apply(i,d))===null)return this.#c([{path:"target",message:"batch action is not applicable"}]);r=ze(r,d,p),i=this.#l(r).state,o.push(d.id)}return this.#h(r,o),{ok:!0,ids:o}}#v(e,n){const s=y(Yt,e);if(!s.success)return{ok:!1,issue:se(s.issues)};const r=this.descriptorFor(s.output.type,typeof s.output.target=="string"?Ue(s.output.target,"page"):s.output.target);if(!r)return{ok:!1,issue:{path:"type",message:`unknown action type "${s.output.type}"`}};const i=Ws(s.output,r);if(!i.ok)return i;const o=this.definition.canonicalTarget?.(n,i.action.target)??i.action.target;return{ok:!0,action:{...i.action,target:o}}}#c(e){return this.#m=e,{ok:!1,issues:e}}removeAction(e){const n=this.#n.filter(s=>s.id!==e);n.length!==this.#n.length&&this.#h(n)}clearActions(){this.#n.length>0&&this.#h([])}replaceActions(e){this.#h(Hn(this.definition,e))}setBase(e){this.#i=e,this.#h(this.#n)}subscribe(e){return this.#p.add(e),()=>{this.#p.delete(e)}}exportDraft(e){return{template:this.definition.name,frameworkVersion:e,exportedAt:new Date().toISOString(),actions:this.#n}}#h(e,n){this.#m=[],this.#n=e,this.#g(),this.#o=this.#l(this.#n),this.#w(n),this.#y();for(const s of this.#p)s()}#w(e){const n=this.#k(),s=gi(this.definition,this.#o,r=>this.#l(r),e);return s===this.#o?n:(this.#f+=this.#n.length-s.actions.length,this.#n=[...s.actions],this.#g(),this.#o=this.#l(this.#n),this.#k(),!0)}#k(){return this.#o.obsolete.length===0?!1:(this.#f+=this.#o.obsolete.length,this.#n=Pn(this.#o),this.#g(),this.#o=this.#l(this.#n),!0)}#y(){this.#a?.save(this.#d,this.definition.name,this.#n)}}const Bn=(t,e,n)=>e==="comment"?Zt:n!==void 0&&T({type:e,target:n})?Xs:ye(t.actions,e),Hn=(t,e)=>e.flatMap(n=>{const s=y(V,n);if(!s.success)return[];const r=s.output,i=Bn(t,r.type,r.target);if(!i)return[];const o=y(i.schema,r);if(!o.success)return[];const l=y(V,o.output);return l.success?[l.output]:[]}),wi=()=>({status:{kind:"idle"},request:0}),$i=(t,e)=>{switch(e.kind){case"copy-started":return{status:{kind:"copying"},request:t.request+1};case"send-started":return{status:{kind:"sending"},request:t.request+1};case"copy-finished":return e.request!==t.request||t.status.kind!=="copying"?t:{...t,status:{kind:e.ok?"copied":"copy-failed"}};case"send-finished":return e.request!==t.request||t.status.kind!=="sending"?t:{...t,status:e.outcome.ok?{kind:"sent"}:{kind:"send-failed",reason:e.outcome.reason}};case"settled":return e.request===t.request?{...t,status:{kind:"idle"}}:t}},Ai=(t,e)=>{if(t.actions===0||t.railOpen)return null;const n=G(t.locale),s=e.status;return{send:t.sendable?{label:s.kind==="sending"?n.handoffSending:s.kind==="sent"?n.handoffSent:n.handoffSend,disabled:s.kind==="sending"}:null,copy:s.kind==="copied"?{label:n.handoffCopied,status:"copied"}:s.kind==="copy-failed"?{label:n.handoffCopyFailed,status:"failed"}:{label:n.handoffCopy,status:"idle"},note:s.kind==="send-failed"?Ge(s.reason,t.locale):null}},Fn=t=>{const e=t.derivation();return{base:e.base,state:e.state,navigation:t.navigation(),actions:t.controller().actions,comments:e.comments,stale:e.stale,issues:t.issues()}},Ci=t=>{const e=t.derivation();return{state:e.state,base:e.base,navigation:t.navigation(),actions:t.controller().actions,comments:e.comments,stale:e.stale,commentCount:n=>{const s=typeof n=="string"?n:_(n);return e.commentsByTarget.get(s)?.length??0},dispatch:n=>t.dispatch(n),dispatchBatch:n=>t.dispatchBatch(n),navigate:(n,s)=>t.navigate(n,s),hashFor:n=>t.hashFor(n),requestComment:n=>t.requestComment(n)}},Si=(t,e)=>{const n=()=>Fn(t);return{version:Y,template:t.definition.name,host:e,ready:t.ready,get base(){return t.controller().base},get state(){return t.derivation().state},get navigation(){return t.navigation()},get actions(){return t.controller().actions},get comments(){return t.derivation().comments},get stale(){return t.derivation().stale},get issues(){return t.issues()},dispatch:s=>t.dispatch(s),dispatchBatch:s=>t.dispatchBatch(s),comment:(s,r)=>t.dispatch({type:E,target:s,payload:{body:r}}),removeAction:s=>t.removeAction(s),clearActions:()=>t.clearActions(),importDraft:s=>t.controller().replaceActions(s),navigate:(s,r)=>t.navigate(s,r),hashFor:s=>t.hashFor(s),snapshot:n,exportDraft:()=>t.controller().exportDraft(Y),exportBrief:()=>We(n(),t.controller().definition,Y),subscribe:s=>t.subscribe(s)}},it=(t,e)=>typeof t=="object"&&t!==null&&e.every(n=>typeof Reflect.get(t,n)=="function"),_i=t=>it(t,["use"]),Ei=t=>it(t,["anchorFor","canSendToClaude","sendToClaude"]),Ti=t=>it(t,["collection"]),Kn=async(t,e)=>{try{return await t.use(e)}catch{return null}},Mi=(t,e)=>({async canSend(){try{return await t.canSendToClaude()==="available"}catch{return!1}},async send({brief:n,draft:s,anchor:r}){let i=pr(n);if(i===null){if(e===null)return{ok:!1,reason:"too_large"};try{const o=e.collection(dr).doc();await o.set({brief:n,draft:s,createdAt:new Date().toISOString()}),i=hr(o.path)}catch{return{ok:!1,reason:"storage"}}}try{return await t.sendToClaude({anchor:await t.anchorFor(r),text:i}),{ok:!0}}catch(o){return{ok:!1,reason:fr(o)}}}}),Oi=async t=>{if(!_i(t))return null;const[e,n]=await Promise.all([Kn(t,"comments"),Kn(t,"db")]);return Ei(e)?Mi(e,Ti(n)?n:null):null},ji=()=>Reflect.get(globalThis,"claude");class Ri{#e;#r;#s=null;#t=!1;constructor(e,n=ji){this.#e=e,this.#r=n,e.addController(this)}get available(){return this.#t}hostConnected(){this.#s??=Oi(this.#r()),this.#i(),window.addEventListener("focus",this.#i)}hostDisconnected(){window.removeEventListener("focus",this.#i)}async send(e){const n=await this.#s;if(!n)return{ok:!1,reason:"forbidden"};const s=await n.send(e);return this.#i(),s}#i=async()=>{const e=await this.#s,n=e?await e.canSend():!1;n!==this.#t&&(this.#t=n,this.#e.requestUpdate())}}const Jn=(t,e)=>({read(n){try{const s=t.getItem(n);return s===null?null:e(JSON.parse(s))}catch{return null}},write(n,s){try{return t.setItem(n,JSON.stringify(s)),!0}catch{return!1}},remove(n){try{t.removeItem(n)}catch{}}}),$e=t=>{const e=new Map;return Jn({getItem:n=>e.get(n)??null,setItem:(n,s)=>{e.set(n,s)},removeItem:n=>{e.delete(n)}},t)},ot=t=>{try{if(typeof localStorage<"u")return Jn(localStorage,t)}catch{}return $e(t)},at="dev-process-kit:color-scheme",Li="(prefers-color-scheme: dark)",Vn=()=>typeof matchMedia=="function"?matchMedia(Li):null,Wn=()=>ie(document.documentElement.dataset.theme)??(Vn()?.matches===!0?"dark":"light");class Ni{#e;#r;#s=null;#t=null;#i="light";#n=null;#o=null;constructor(e,n){this.#e=e,this.#r=n,e.addController(this)}hostConnected(){this.#s===null&&(this.#s=this.#r()?ot(ie):$e(ie),this.#t=this.#s.read(at)),this.#i=Wn(),this.#n=Vn(),this.#n?.addEventListener("change",this.#d),this.#o=new MutationObserver(this.#d),this.#o.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]})}hostDisconnected(){this.#n?.removeEventListener("change",this.#d),this.#n=null,this.#o?.disconnect(),this.#o=null}resolve(e){return An(this.#a(e))}toggle(e){this.#t=Ur(this.#a(e)),this.#t===null?this.#s?.remove(at):this.#s?.write(at,this.#t),this.#e.requestUpdate()}#a(e){return{preference:this.#t,authored:e,environment:this.#i}}#d=()=>{const e=Wn();e!==this.#i&&(this.#i=e,this.#e.requestUpdate())}}const Pi=(t,e)=>{const n=[],s=r=>{(r===t||r instanceof ShadowRoot)&&e?.(r);for(const i of r.children)i.hasAttribute("data-template")||(("commentTargets"in i||"elementActions"in i)&&n.push(i),s(i),i.shadowRoot&&s(i.shadowRoot))};return s(t),n},Yn=(t,e)=>{const n=new Map;for(const s of t)n.set(e(s),(n.get(e(s))??0)+1);return t.filter(s=>n.get(e(s))===1)},Gn=t=>Yn(t.filter(e=>"elementActions"in e&&e.id.length>0),e=>e.id),Zn=(t,e)=>{for(const n of Gn(t)){const s=tr(e,n.id),r=Reflect.get(n,"elementActions");Array.isArray(r)&&r.length===s.length&&s.every((o,l)=>{const a=r[l];return typeof a=="object"&&a!==null&&"id"in a&&a.id===o.id})||Reflect.set(n,"elementActions",s)}},Di=t=>{const e=Reflect.get(t,"elementActionResults");return Array.isArray(e)?e.flatMap(n=>{const s=y(en,n);return s.success?[s.output]:[]}):[]},Ii=t=>{const e=[];for(const n of t){if(!("commentTargets"in n))continue;const s=y(Cn,n.commentTargets);s.success&&e.push(...s.output)}return{targets:Yn(e,n=>n.value),providers:Gn(t).map(n=>({id:n.id,results:Di(n)}))}},Ui=2400;class qi{#e=wi();#r=null;#s;constructor(e){this.#s=e,e.addController(this)}get state(){return this.#e}hostDisconnected(){this.#n()}async copy(e){this.#t({kind:"copy-started"});const n=this.#e.request,s=await Ye(e()).catch(()=>!1);this.#t({kind:"copy-finished",request:n,ok:s}),this.#i(n)}async send(e){if(this.#e.status.kind==="sending")return;this.#t({kind:"send-started"});const n=this.#e.request,s=await e().catch(()=>({ok:!1,reason:"error"}));this.#t({kind:"send-finished",request:n,outcome:s}),s.ok&&this.#i(n)}#t(e){(e.kind==="copy-started"||e.kind==="send-started")&&this.#n(),this.#e=$i(this.#e,e),this.#s.requestUpdate()}#i(e){e===this.#e.request&&(this.#n(),this.#r=setTimeout(()=>{this.#r=null,this.#t({kind:"settled",request:e})},Ui))}#n(){this.#r!==null&&clearTimeout(this.#r),this.#r=null}}const dt="dev-process-kit:locale";class zi{#e;#r;#s;#t=null;#i=null;#n;#o;constructor(e,n,s){this.#e=e,this.#r=n,this.#s=s,e.addController(this)}get authored(){if(this.#n===void 0)return Re(Oe(this.#e));const e=this.#e.parentNode;return Re(this.#n??(e===null?null:Oe(e)))}get locale(){return this.#o??this.#a()}#a(){return xs({preference:this.#i,authored:this.authored})}hostConnected(){this.#t===null&&(this.#t=this.#r()?ot(Ot):$e(Ot),this.#i=this.#t.read(dt)),this.#n??=this.#e.getAttribute("lang"),this.#d()}pick(e){this.#i=ws(e,this.authored),this.#i===null?this.#t?.remove(dt):this.#t?.write(dt,this.#i),this.#d(),this.#e.requestUpdate()}#d(){const e=this.#i??this.#n??null;e===null?this.#e.removeAttribute("lang"):this.#e.getAttribute("lang")!==e&&this.#e.setAttribute("lang",e);const n=this.#a();if(n===this.#o)return;const s=this.#o===void 0;this.#o=n,this.#s(),(!s||this.#i!==null)&&document.dispatchEvent(new Event(Le))}}const Qn=()=>Je(typeof location>"u"?"":location.hash),Bi=(t,e)=>{if(typeof history>"u")return;const n=`${location.pathname}${location.search}${W(t)}`;`${location.pathname}${location.search}${location.hash}`!==n&&(e?history.replaceState(null,"",n):history.pushState(null,"",n))};class Hi{#e;#r=null;#s=0;constructor(e){this.#e=e}get orphans(){return this.#s}route(){const e=this.#e.renderRoot,n=F(e.querySelector('slot[name="preview"]'),HTMLSlotElement);if(n===null)return;this.#r!==n&&(this.#r=n,n.addEventListener("slotchange",this.#t));const s=new Set(Array.from(e.querySelectorAll("slot")).map(i=>i.getAttribute("name")??"")),r=n.assignedElements();for(const i of r){const o=i.getAttribute("data-preview-id");if(!o)continue;const l=`preview:${o}`;i.getAttribute("slot")!==l&&s.has(l)&&i.setAttribute("slot",l)}r.length!==this.#s&&(this.#s=r.length,queueMicrotask(()=>this.#e.requestUpdate()))}#t=()=>{queueMicrotask(()=>this.route())}}const Fi=[fe,ge,R`
|
|
1184
1184
|
:host {
|
|
1185
1185
|
display: block;
|
|
1186
1186
|
min-height: 100%;
|
|
@@ -1750,7 +1750,7 @@ The brief is too long for a comment, so it is stored in this artifact's database
|
|
|
1750
1750
|
display: none;
|
|
1751
1751
|
}
|
|
1752
1752
|
}
|
|
1753
|
-
`];class
|
|
1753
|
+
`];class Ki extends O{static{this.styles=Fi}static{this.properties={storageKey:{type:String,attribute:"storage-key"},storage:{type:String},notes:{type:String},theme:{type:String},notesOpen:{state:!0}}}#e=!1;#r=new Hi(this);#s=new Ni(this,()=>this.storage!=="off"&&this.storage!=="memory");#t=new Ri(this);#i=new qi(this);#n=new zi(this,()=>this.storage!=="off"&&this.storage!=="memory",()=>this.#a?.setTemplate(this.definition));#o;#a;#d=Ke;#p=null;#m=new Set;#f=null;#g;#l;#v;#c=[];#h;#w=new Promise(e=>{this.#h=e});#k;get locale(){return this.#n.locale}get definition(){const e=this.locale;return this.#o?.locale!==e&&(this.#o={locale:e,value:this.definitionFor(e)}),this.#o.value}connectedCallback(){super.connectedCallback(),this.dataset.template=this.definition.name,this.#e||(this.#e=!0,this.notesOpen=this.notes==="on"||this.notes==="open"),this.#y(),window.addEventListener("hashchange",this.#E),this.addEventListener("click",this.#j),this.addEventListener("dpk-comment-targets-change",this.#u),this.addEventListener("dpk-comment-request",this.#T),this.addEventListener("dpk-comment-submit",this.#M),this.addEventListener("dpk-element-action",this.#O),this.#v??=new MutationObserver(this.#u),this.#u()}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("hashchange",this.#E),this.removeEventListener("click",this.#j),this.#l?.disconnect(),this.#v?.disconnect(),this.removeEventListener("dpk-comment-targets-change",this.#u),this.removeEventListener("dpk-comment-request",this.#T),this.removeEventListener("dpk-comment-submit",this.#M),this.removeEventListener("dpk-element-action",this.#O)}#y(e=0){if(this.#a){this.#C();return}if(this.childNodes.length===0&&e<2){queueMicrotask(()=>this.#y(e+1));return}this.#D()}#C(){this.#g||(this.#g=this.#a?.subscribe(()=>this.#z()))}willUpdate(){this.dataset.theme=this.#s.resolve(ie(this.theme))}updated(){this.#H(),this.#B()}get api(){return this.#k??=this.#P(),this.#k}get controller(){if(!this.#a)throw new Error(`<${this.tagName.toLowerCase()}> is not initialized yet`);return this.#a}get derivation(){return this.controller.derivation}get navigation(){return this.#d}dispatch(e){const n=this.controller.dispatch(e);return n.ok||(this.requestUpdate(),this.dispatchEvent(new CustomEvent("dpk-error",{detail:{issues:n.issues},bubbles:!0,composed:!0})),this.#b()),n}dispatchBatch(e){const n=this.controller.dispatchBatch(e);return n.ok||(this.requestUpdate(),this.dispatchEvent(new CustomEvent("dpk-error",{detail:{issues:n.issues},bubbles:!0,composed:!0})),this.#b()),n}removeAction(e){this.controller.removeAction(e)}clearActions(){this.controller.clearActions()}navigate(e,n={}){const s=W(this.#x());this.#d=Ve(this.#d,e,this.definition.navigationHierarchy),this.#$(n.replace??!1);const r=W(this.#x());this.requestUpdate(),s!==r&&(this.#b(),this.dispatchEvent(new CustomEvent("dpk-navigate",{detail:{navigation:this.#d},bubbles:!0,composed:!0})))}hashFor(e){const n=this.#x();return W(this.definition.resolveNavigation(this.derivation.state,Ve(n,e,this.definition.navigationHierarchy)))}requestComment(e){this.#p=typeof e=="string"?e:_(e),this.notesOpen=!0,this.requestUpdate()}get integratedReview(){return!1}get canSendToClaude(){return this.#t.available}sendToClaude(){return this.#t.send({brief:this.api.exportBrief(),draft:Be(this.derivation.actions),anchor:this})}renderReviewPanel(e){return f`<dpk-component-comment-panel
|
|
1754
1754
|
.definition=${this.controller.definition}
|
|
1755
1755
|
.state=${e.state}
|
|
1756
1756
|
.navigation=${e.navigation}
|
|
@@ -1763,7 +1763,7 @@ The brief is too long for a comment, so it is stored in this artifact's database
|
|
|
1763
1763
|
.onDelete=${n=>this.removeAction(n)}
|
|
1764
1764
|
.onClear=${()=>this.clearActions()}
|
|
1765
1765
|
.onComment=${(n,s)=>{const r=this.dispatch({type:E,target:n,payload:{body:s}});return r.ok&&(this.#p=null),r}}
|
|
1766
|
-
></dpk-component-comment-panel>`}renderChrome(e,n){const s=e.actions.length,r=e.comments.length,i=
|
|
1766
|
+
></dpk-component-comment-panel>`}renderChrome(e,n){const s=e.actions.length,r=e.comments.length,i=G(this.locale);return f`
|
|
1767
1767
|
<div class="dpk-shell">
|
|
1768
1768
|
<header class="dpk-header">
|
|
1769
1769
|
<span class="dpk-brand" aria-hidden="true"></span>
|
|
@@ -1776,7 +1776,7 @@ The brief is too long for a comment, so it is stored in this artifact's database
|
|
|
1776
1776
|
<slot name="header"></slot>
|
|
1777
1777
|
</div>
|
|
1778
1778
|
<div class="dpk-header-meta">
|
|
1779
|
-
<span>dev-process-kit@${
|
|
1779
|
+
<span>dev-process-kit@${Y}</span>
|
|
1780
1780
|
<span>${this.definition.name}</span>
|
|
1781
1781
|
<span class="dpk-meta-count" data-active=${s>0?"true":"false"}>
|
|
1782
1782
|
${s} draft · ${r} note
|
|
@@ -1833,7 +1833,7 @@ The brief is too long for a comment, so it is stored in this artifact's database
|
|
|
1833
1833
|
</button>`}
|
|
1834
1834
|
${this.integratedReview?m:this.#R(s)}
|
|
1835
1835
|
</div>
|
|
1836
|
-
`}#R(e){const n
|
|
1836
|
+
`}#R(e){const n=Ai({actions:e,railOpen:this.notesOpen,sendable:this.canSendToClaude,locale:this.locale},this.#i.state);if(!n)return m;const s=G(this.locale);return f`<div class="dpk-dock" role="group" aria-label=${s.handoffLabel}>
|
|
1837
1837
|
${n.note?f`<p class="dpk-dock-note" role="alert">${n.note}</p>`:m}
|
|
1838
1838
|
<div class="dpk-dock-actions">
|
|
1839
1839
|
${n.send?f`<button
|
|
@@ -1854,16 +1854,16 @@ The brief is too long for a comment, so it is stored in this artifact's database
|
|
|
1854
1854
|
${n.copy.label}
|
|
1855
1855
|
</button>
|
|
1856
1856
|
</div>
|
|
1857
|
-
</div>`}#L(){const e=this.locale,n=
|
|
1857
|
+
</div>`}#L(){const e=this.locale,n=G(e).language;return f`<select
|
|
1858
1858
|
class="dpk-lang-select"
|
|
1859
1859
|
aria-label=${n}
|
|
1860
1860
|
title=${n}
|
|
1861
|
-
@change=${
|
|
1861
|
+
@change=${wn(s=>{const r=je.find(i=>i===s);r!==void 0&&this.#n.pick(r)})}
|
|
1862
1862
|
>
|
|
1863
|
-
${
|
|
1863
|
+
${je.map(s=>f`<option value=${s} lang=${s} ?selected=${s===e}>
|
|
1864
1864
|
${or[s]}
|
|
1865
1865
|
</option>`)}
|
|
1866
|
-
</select>`}#N(){const e=this.dataset.theme==="dark",n=
|
|
1866
|
+
</select>`}#N(){const e=this.dataset.theme==="dark",n=G(this.locale),s=e?n.useLightTheme:n.useDarkTheme;return f`<button
|
|
1867
1867
|
class="dpk-theme-toggle"
|
|
1868
1868
|
type="button"
|
|
1869
1869
|
aria-label=${s}
|
|
@@ -1871,4 +1871,4 @@ The brief is too long for a comment, so it is stored in this artifact's database
|
|
|
1871
1871
|
@click=${()=>this.#s.toggle(ie(this.theme))}
|
|
1872
1872
|
>
|
|
1873
1873
|
${e?Mr():Or()}
|
|
1874
|
-
</button>`}render(){if(!this.#a)return m;const e=this.#_();return this.renderChrome(e,this.renderRegions(e))}hasSidebarContent(){return this.querySelector('[slot="sidebar"]')!==null}hasMemoContent(){return this.querySelector('[slot="memo"]')!==null}hasFooterContent(){return this.querySelector('[slot="footer"]')!==null}context(){return this.#_()}#A(){return{definition:this.definition,controller:()=>this.controller,derivation:()=>this.derivation,ready:this.#w,navigation:()=>this.#x(),issues:()=>this.controller.lastIssues,dispatch:e=>this.dispatch(e),dispatchBatch:e=>this.dispatchBatch(e),subscribe:e=>(this.#m.add(e),()=>{this.#m.delete(e)}),removeAction:e=>this.removeAction(e),clearActions:()=>this.clearActions(),navigate:(e,n)=>this.navigate(e,n),hashFor:e=>this.hashFor(e),requestComment:e=>this.requestComment(e)}}#P(){return
|
|
1874
|
+
</button>`}render(){if(!this.#a)return m;const e=this.#_();return this.renderChrome(e,this.renderRegions(e))}hasSidebarContent(){return this.querySelector('[slot="sidebar"]')!==null}hasMemoContent(){return this.querySelector('[slot="memo"]')!==null}hasFooterContent(){return this.querySelector('[slot="footer"]')!==null}context(){return this.#_()}#A(){return{definition:this.definition,controller:()=>this.controller,derivation:()=>this.derivation,ready:this.#w,navigation:()=>this.#x(),issues:()=>this.controller.lastIssues,dispatch:e=>this.dispatch(e),dispatchBatch:e=>this.dispatchBatch(e),subscribe:e=>(this.#m.add(e),()=>{this.#m.delete(e)}),removeAction:e=>this.removeAction(e),clearActions:()=>this.clearActions(),navigate:(e,n)=>this.navigate(e,n),hashFor:e=>this.hashFor(e),requestComment:e=>this.requestComment(e)}}#P(){return Si(this.#A(),this)}#S(){return Fn(this.#A())}#_(){return Ci(this.#A())}#x(){return this.definition.resolveNavigation(this.derivation.state,this.#d)}#D(){const e=this.#U();this.#d=Qn();const n=this.storageKey;this.#a=new zn({definition:this.definition,base:e,storage:this.#I(),...typeof n=="string"?{storageKey:n}:{}}),this.#C(),this.#u(),this.#$(!0),this.#h?.(),this.#q(),this.requestUpdate()}#I(){return this.storage==="off"?null:this.storage==="memory"?new st:rt()}#U(){const e=this.querySelector('script[type="application/json"]');if(!e?.textContent||e.textContent.trim().length===0)return console.warn(`[dev-process-kit] <${this.tagName.toLowerCase()}> has no base JSON; starting from an empty state.`),this.#f='no <script type="application/json"> child found',this.definition.emptyBase();try{return this.definition.parseBase(JSON.parse(e.textContent))}catch(n){return console.error("[dev-process-kit] invalid base data:",n),this.#f=n instanceof Error?n.message:String(n),this.definition.emptyBase()}}#q(){this.querySelector('script[type="application/json"]')||(this.#l=new MutationObserver(()=>{const e=this.querySelector('script[type="application/json"]');if(e){this.#l?.disconnect(),this.#l=void 0;try{this.controller.setBase(this.definition.parseBase(JSON.parse(e.textContent??"null")))}catch(n){console.error("[dev-process-kit] invalid base data:",n)}}}),this.#l.observe(this,{childList:!0,subtree:!0}))}#b(){const e=this.#S();for(const n of this.#m)n(e)}#z(){if(!this.isConnected){this.requestUpdate(),this.#b();return}this.#$(!0),Zn(this.#c,this.controller.actions),queueMicrotask(this.#u),this.requestUpdate(),this.#b(),this.dispatchEvent(new CustomEvent("dpk-change",{detail:this.#S(),bubbles:!0,composed:!0}))}#$(e){const n=this.#x();this.#d=n,Bi(n,e)}#E=()=>{this.#d=Qn(),this.#$(!0),this.requestUpdate(),this.#b(),this.dispatchEvent(new CustomEvent("dpk-navigate",{detail:{navigation:this.#d},bubbles:!0,composed:!0}))};#u=()=>{this.#v?.disconnect(),this.#c=Pi(this,e=>{this.isConnected&&this.#v?.observe(e,{childList:!0,subtree:!0})}),this.#a&&(Zn(this.#c,this.#a.actions),this.#a.setComponentSnapshot(Ii(this.#c)))};#T=e=>{if(e.stopPropagation(),!(e instanceof CustomEvent)||!this.#a)return;const n=e.detail;typeof n!="object"||n===null||!("target"in n)||typeof n.target!="string"||(this.#u(),!this.controller.definition.commentTargets(this.derivation.state,this.navigation).some(r=>r.value===n.target))||this.requestComment(n.target)};#M=e=>{if(e.stopPropagation(),!(e instanceof CustomEvent)||!e.cancelable||!this.#a)return;const n=y(zr,e.detail);if(!n.success)return;this.#u();const{target:s,body:r}=n.output;if(!this.controller.definition.commentTargets(this.derivation.state,this.navigation).some(l=>l.value===s))return;this.dispatch({type:E,target:s,payload:{body:r}}).ok&&e.preventDefault()};#O=e=>{if(e.stopPropagation(),!(e instanceof CustomEvent)||!e.cancelable||!this.#a)return;const n=y(er,e.detail);if(!n.success)return;this.#u();const{type:s,target:r,payload:i}=n.output;if(!this.controller.definition.commentTargets(this.derivation.state,this.navigation).some(a=>a.value===r))return;this.dispatch({type:s,target:r,payload:i}).ok&&e.preventDefault()};#j=e=>{for(const n of e.composedPath()){if(!(n instanceof Element))continue;if(n===this||n.hasAttribute("data-template"))break;const s=n.getAttribute("data-dpk-navigate");if(s!==null){e.preventDefault(),this.navigate(Je(s.includes("=")?s:`step=${s}`));return}const r=n.getAttribute("data-dpk-comment");if(r!==null){e.preventDefault(),this.requestComment(r);return}}};#B(){const e=this.renderRoot.querySelector(".dpk-shell"),n=this.renderRoot.querySelector(".dpk-dock-actions");e&&(n?e.style.setProperty("--dpk-dock-space",`${n.offsetWidth+8}px`):e.style.removeProperty("--dpk-dock-space"))}#H(){this.#r.route()}}const Ji=(t,e)=>{typeof window>"u"||Object.assign(window,{devProcessKit:{version:t,templates:e}})};export{As as $,Xe as A,$r as B,E as C,xn as D,Ke as E,Y as F,bn as G,yn as H,vn as I,kn as J,mn as K,Pn as L,st as M,Je as N,Jt as O,zs as P,Ve as Q,Bs as R,Be as S,Ki as T,Vt as U,_ as V,nt as W,ke as X,Ue as Y,fe as Z,ue as _,Ji as a,R as a0,m as a1,f as a2,gn as a3,cs as a4,O as a5,Ne as a6,Er as a7,Tr as a8,Kt as a9,Ir as aA,we as aB,F as aC,Ge as aD,Ye as aE,Us as aF,ln as aG,cn as aH,un as aI,Sr as aJ,wr as aK,xr as aL,J as aa,ve as ab,U as ac,g as ad,be as ae,b as af,k as ag,qt as ah,Ft as ai,q as aj,K as ak,Dt as al,y as am,$ as an,It as ao,Ie as ap,Nt as aq,Lt as ar,Ut as as,Is as at,_r as au,S as av,ot as aw,$e as ax,Dr as ay,wn as az,Zt as b,Rt as c,zn as d,ze as e,Hs as f,We as g,Gt as h,xe as i,Ln as j,ge as k,Wt as l,Vs as m,qe as n,rt as o,qn as p,qs as q,Nr as r,Ss as s,Nn as t,V as u,Ks as v,W as w,Cr as x,Ar as y,Qe as z};
|