commerce-kit 0.42.0 → 0.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -100,6 +100,27 @@ await commerce.eventUpdate({ idOrSlug: 'summer-fest' }, { capacity: 600, status:
100
100
  const { attendees, totalTickets } = await commerce.eventAttendeesBrowse({ idOrSlug: 'summer-fest' });
101
101
  ```
102
102
 
103
+ ## Collections & Categories
104
+
105
+ Full CRUD for product collections, product categories, and blog categories. Mutations are
106
+ partial (send only the fields you want to change; pass `null` to clear an optional field).
107
+
108
+ ```typescript
109
+ // Collections — create, partially update, delete
110
+ const collection = await commerce.collectionCreate({ name: 'Summer', filter: { type: 'manual' }, active: true });
111
+ await commerce.collectionUpdate({ idOrSlug: 'summer' }, { name: 'Summer 2026', active: false });
112
+ await commerce.collectionDelete({ idOrSlug: 'summer' }); // { ok: true, deleted: 1 }
113
+
114
+ // Categories — delete (create/update already supported)
115
+ await commerce.categoryUpdate({ idOrSlug: 'shoes' }, { name: 'Footwear' });
116
+ await commerce.categoryDelete({ idOrSlug: 'footwear' }); // 409 if still referenced by products
117
+
118
+ // Blog categories — full CRUD
119
+ const blogCategory = await commerce.blogCategoryCreate({ name: 'Guides' });
120
+ await commerce.blogCategoryUpdate({ idOrSlug: 'guides' }, { description: null });
121
+ await commerce.blogCategoryDelete({ idOrSlug: 'guides' });
122
+ ```
123
+
103
124
  ## Raw API Requests
104
125
 
105
126
  For endpoints not yet implemented in the SDK, use the `request()` method:
@@ -3042,7 +3042,9 @@ type APIProductGetByIdResult = ({
3042
3042
  }) & {
3043
3043
  lang?: string;
3044
3044
  });
3045
- type APIProductGetByIdParams = any;
3045
+ type APIProductGetByIdParams = {
3046
+ idOrSlug: string;
3047
+ };
3046
3048
  type APIProductGetByIdQueryParams = {
3047
3049
  lang?: string;
3048
3050
  currency?: string;
@@ -6060,7 +6062,9 @@ type APIOrderGetByIdResult = {
6060
6062
  }[] | null;
6061
6063
  };
6062
6064
  };
6063
- type APIOrderGetByIdParams = any;
6065
+ type APIOrderGetByIdParams = {
6066
+ id: string;
6067
+ };
6064
6068
  type APICategoriesBrowseResult = Omit<{
6065
6069
  data: {
6066
6070
  id: string;
@@ -6340,7 +6344,9 @@ type APICategoryGetByIdResult = ({
6340
6344
  }) & {
6341
6345
  lang?: string;
6342
6346
  };
6343
- type APICategoryGetByIdParams = any;
6347
+ type APICategoryGetByIdParams = {
6348
+ idOrSlug: string;
6349
+ };
6344
6350
  type APICategoryGetByIdQueryParams = {
6345
6351
  lang?: string;
6346
6352
  };
@@ -6503,7 +6509,9 @@ type APICollectionGetByIdResult = ({
6503
6509
  }) & {
6504
6510
  lang?: string;
6505
6511
  };
6506
- type APICollectionGetByIdParams = any;
6512
+ type APICollectionGetByIdParams = {
6513
+ idOrSlug: string;
6514
+ };
6507
6515
  type APICollectionGetByIdQueryParams = {
6508
6516
  lang?: string;
6509
6517
  };
@@ -6686,6 +6694,10 @@ type APIMeGetResult = {
6686
6694
  cartRecommendations?: {
6687
6695
  layout: "inline" | "sidebar";
6688
6696
  } | null | undefined;
6697
+ stockHold?: {
6698
+ enabled: boolean;
6699
+ holdMinutes: number;
6700
+ } | null | undefined;
6689
6701
  aiInstructions?: string | null | undefined;
6690
6702
  blogSettings?: {
6691
6703
  modelTier: "extra" | "max" | "regular";
@@ -6913,7 +6925,9 @@ type APIPostGetByIdResult = {
6913
6925
  filters: unknown;
6914
6926
  publishedAt: string | null;
6915
6927
  } | null | undefined;
6916
- type APIPostGetByIdParams = any;
6928
+ type APIPostGetByIdParams = {
6929
+ idOrSlug: string;
6930
+ };
6917
6931
  type APIPostCreateBody = {
6918
6932
  title: string;
6919
6933
  slug: string;
@@ -7033,7 +7047,60 @@ type APIBlogCategoryGetByIdResult = {
7033
7047
  canonical?: string | null | undefined;
7034
7048
  } | null;
7035
7049
  };
7036
- type APIBlogCategoryGetByIdParams = any;
7050
+ type APIBlogCategoryGetByIdParams = {
7051
+ idOrSlug: string;
7052
+ };
7053
+ type APIBlogCategoryCreateBody = {
7054
+ name: string;
7055
+ slug?: string | undefined;
7056
+ description?: string | null | undefined;
7057
+ image?: string | null | undefined;
7058
+ };
7059
+ type APIBlogCategoryCreateResult = {
7060
+ id: string;
7061
+ name: string;
7062
+ image: string | null;
7063
+ createdAt: string;
7064
+ updatedAt: string;
7065
+ slug: string;
7066
+ active: boolean;
7067
+ storeId: string;
7068
+ description: string | null;
7069
+ position: string;
7070
+ seo: {
7071
+ title?: string | null | undefined;
7072
+ description?: string | null | undefined;
7073
+ canonical?: string | null | undefined;
7074
+ } | null;
7075
+ };
7076
+ type APIBlogCategoryUpdateBody = {
7077
+ name?: string | undefined;
7078
+ slug?: string | undefined;
7079
+ description?: string | null | undefined;
7080
+ image?: string | null | undefined;
7081
+ active?: boolean | undefined;
7082
+ };
7083
+ type APIBlogCategoryUpdateResult = {
7084
+ id: string;
7085
+ name: string;
7086
+ image: string | null;
7087
+ createdAt: string;
7088
+ updatedAt: string;
7089
+ slug: string;
7090
+ active: boolean;
7091
+ storeId: string;
7092
+ description: string | null;
7093
+ position: string;
7094
+ seo: {
7095
+ title?: string | null | undefined;
7096
+ description?: string | null | undefined;
7097
+ canonical?: string | null | undefined;
7098
+ } | null;
7099
+ };
7100
+ type APIBlogCategoryDeleteResult = {
7101
+ ok: boolean;
7102
+ deleted: number;
7103
+ };
7037
7104
  type APIPostCommentsBrowseResult = {
7038
7105
  data: Array<{
7039
7106
  id: string;
@@ -7100,7 +7167,9 @@ type APICustomerGetByIdResult = {
7100
7167
  }>;
7101
7168
  createdAt: string;
7102
7169
  };
7103
- type APICustomerGetByIdParams = any;
7170
+ type APICustomerGetByIdParams = {
7171
+ id: string;
7172
+ };
7104
7173
  type APICustomerUpdateBody = {
7105
7174
  name?: string;
7106
7175
  phone?: string;
@@ -7196,7 +7265,9 @@ type APIVariantGetByIdResult = {
7196
7265
  images: string[];
7197
7266
  };
7198
7267
  };
7199
- type APIVariantGetByIdParams = any;
7268
+ type APIVariantGetByIdParams = {
7269
+ idOrSku: string;
7270
+ };
7200
7271
  type APIVariantGetByIdQueryParams = {
7201
7272
  currency?: string;
7202
7273
  };
@@ -7374,6 +7445,10 @@ type APICategoryUpdateResult = {
7374
7445
  longDescription: JSONContent | null;
7375
7446
  parentId: string | null;
7376
7447
  };
7448
+ type APICategoryDeleteResult = {
7449
+ ok: boolean;
7450
+ deleted: number;
7451
+ };
7377
7452
  type APIOrderUpdateBody = {
7378
7453
  status?: "processing" | "shipped" | "delivered" | "canceled";
7379
7454
  trackingNumber?: string;
@@ -7435,6 +7510,78 @@ type APICollectionCreateResult = {
7435
7510
  count: number;
7436
7511
  };
7437
7512
  };
7513
+ type APICollectionUpdateBody = {
7514
+ name?: string | undefined;
7515
+ slug?: string | undefined;
7516
+ description?: string | null | undefined;
7517
+ image?: string | null | undefined;
7518
+ filter?: {
7519
+ type: "manual";
7520
+ } | {
7521
+ type: "dynamicPrice";
7522
+ min?: number | null | undefined;
7523
+ max?: number | null | undefined;
7524
+ } | undefined;
7525
+ active?: boolean | undefined;
7526
+ };
7527
+ type APICollectionUpdateResult = {
7528
+ id: string;
7529
+ name: string;
7530
+ image: string | null;
7531
+ createdAt: string;
7532
+ updatedAt: string;
7533
+ slug: string;
7534
+ active: boolean;
7535
+ filter: {
7536
+ type: "manual";
7537
+ } | {
7538
+ type: "dynamicPrice";
7539
+ min?: number | null | undefined;
7540
+ max?: number | null | undefined;
7541
+ };
7542
+ storeId: string;
7543
+ description: JSONContent | null;
7544
+ seo: {
7545
+ title?: string | null | undefined;
7546
+ description?: string | null | undefined;
7547
+ canonical?: string | null | undefined;
7548
+ } | null;
7549
+ longDescription: JSONContent | null;
7550
+ kind: "product" | "event";
7551
+ productCollections: {
7552
+ position: string | null;
7553
+ productId: string;
7554
+ collectionId: string;
7555
+ product: {
7556
+ id: string;
7557
+ name: string;
7558
+ createdAt: string;
7559
+ updatedAt: string;
7560
+ type: "set" | "product" | "bundle";
7561
+ slug: string;
7562
+ status: "published" | "draft" | "hidden" | null;
7563
+ flags: unknown;
7564
+ storeId: string;
7565
+ summary: string | null;
7566
+ content: JSONContent | null;
7567
+ images: string[];
7568
+ badge: unknown;
7569
+ bundleDiscountPercentage: string | null;
7570
+ seo: {
7571
+ title?: string | null | undefined;
7572
+ description?: string | null | undefined;
7573
+ canonical?: string | null | undefined;
7574
+ } | null;
7575
+ stripeTaxCode: string | null;
7576
+ categoryId: string | null;
7577
+ brandId: string | null;
7578
+ };
7579
+ }[];
7580
+ };
7581
+ type APICollectionDeleteResult = {
7582
+ ok: boolean;
7583
+ deleted: number;
7584
+ };
7438
7585
  type APIProductReviewsBrowseResult = {
7439
7586
  data: Array<{
7440
7587
  id: string;
@@ -7504,7 +7651,9 @@ type APIInstaviewImagesBrowseResult = {
7504
7651
  }>;
7505
7652
  nextCursor: string | null;
7506
7653
  };
7507
- type APIInstaviewImagesBrowseParams = any;
7654
+ type APIInstaviewImagesBrowseParams = {
7655
+ handle: string;
7656
+ };
7508
7657
  type APIInstaviewImagesBrowseQueryParams = {
7509
7658
  limit?: number;
7510
7659
  cursor?: string;
@@ -7534,7 +7683,9 @@ type APIEventsBrowseResult = {
7534
7683
  }[];
7535
7684
  total: number;
7536
7685
  };
7537
- type APIEventGetByIdParams = any;
7686
+ type APIEventGetByIdParams = {
7687
+ idOrSlug: string;
7688
+ };
7538
7689
  type APIEventGetByIdResult = {
7539
7690
  event: {
7540
7691
  id: string;
@@ -7670,7 +7821,9 @@ type APIBrandsBrowseQueryParams = {
7670
7821
  active?: boolean | undefined;
7671
7822
  lang?: string | undefined;
7672
7823
  };
7673
- type APIBrandGetByIdParams = any;
7824
+ type APIBrandGetByIdParams = {
7825
+ idOrSlug: string;
7826
+ };
7674
7827
  type APIBrandGetByIdResult = {
7675
7828
  id: string;
7676
7829
  name: string;
@@ -7828,7 +7981,9 @@ type APIBrandAssignProductsResult = {
7828
7981
  assigned: number;
7829
7982
  notFound: string[];
7830
7983
  };
7831
- type APIOrderRefundsParams = any;
7984
+ type APIOrderRefundsParams = {
7985
+ id: string;
7986
+ };
7832
7987
  type APIOrderRefundsBrowseResult = {
7833
7988
  data: {
7834
7989
  createdAt: string;
@@ -7864,7 +8019,10 @@ type APIOrderRefundsBrowseQueryParams = {
7864
8019
  offset?: number | undefined;
7865
8020
  limit?: number | undefined;
7866
8021
  };
7867
- type APIOrderRefundGetParams = any;
8022
+ type APIOrderRefundGetParams = {
8023
+ id: string;
8024
+ refundId: string;
8025
+ };
7868
8026
  type APIOrderRefundGetResult = {
7869
8027
  id: string;
7870
8028
  createdAt: string;
@@ -7915,4 +8073,4 @@ type APICartDeleteResult = {
7915
8073
  success: boolean;
7916
8074
  };
7917
8075
 
7918
- export type { APIBlogCategoriesBrowseQueryParams, APIBlogCategoriesBrowseResult, APIBlogCategoryGetByIdParams, APIBlogCategoryGetByIdResult, APIBrandAssignProductsBody, APIBrandAssignProductsResult, APIBrandCreateBody, APIBrandCreateResult, APIBrandDeleteResult, APIBrandGetByIdParams, APIBrandGetByIdResult, APIBrandUpdateBody, APIBrandUpdateResult, APIBrandsBrowseQueryParams, APIBrandsBrowseResult, APICartAddBody, APICartAddResult, APICartCreateBody, APICartCreateResult, APICartDeleteResult, APICartGetResult, APICartRemoveItemQueryParams, APICartRemoveItemResult, APICategoriesBrowseQueryParams, APICategoriesBrowseResult, APICategoryCreateBody, APICategoryCreateResult, APICategoryGetByIdParams, APICategoryGetByIdQueryParams, APICategoryGetByIdResult, APICategoryUpdateBody, APICategoryUpdateQueryParams, APICategoryUpdateResult, APICollectionCreateBody, APICollectionCreateResult, APICollectionGetByIdParams, APICollectionGetByIdQueryParams, APICollectionGetByIdResult, APICollectionsBrowseQueryParams, APICollectionsBrowseResult, APIContactMessageCreateBody, APIContactMessageCreateResult, APICustomerAddressCreateBody, APICustomerAddressCreateResult, APICustomerGetByIdParams, APICustomerGetByIdResult, APICustomerOrdersBrowseQueryParams, APICustomerOrdersBrowseResult, APICustomerUpdateBody, APICustomerUpdateResult, APICustomersBrowseQueryParams, APICustomersBrowseResult, APIEventAttendeesBrowseResult, APIEventCreateBody, APIEventCreateResult, APIEventGetByIdParams, APIEventGetByIdResult, APIEventUpdateBody, APIEventUpdateResult, APIEventsBrowseQueryParams, APIEventsBrowseResult, APIInstaviewImagesBrowseParams, APIInstaviewImagesBrowseQueryParams, APIInstaviewImagesBrowseResult, APIInventoryAdjustBody, APIInventoryAdjustResult, APIInventoryBrowseQueryParams, APIInventoryBrowseResult, APILegalPageGetByPathResult, APILegalPagesBrowseResult, APIMeGetResult, APIOrderGetByIdParams, APIOrderGetByIdResult, APIOrderRefundGetParams, APIOrderRefundGetResult, APIOrderRefundsBrowseQueryParams, APIOrderRefundsBrowseResult, APIOrderRefundsParams, APIOrderUpdateBody, APIOrderUpdateResult, APIOrdersBrowseQueryParams, APIOrdersBrowseResult, APIPostCommentCreateBody, APIPostCommentCreateResult, APIPostCommentsBrowseQueryParams, APIPostCommentsBrowseResult, APIPostCreateBody, APIPostCreateResult, APIPostDeleteResult, APIPostGetByIdParams, APIPostGetByIdResult, APIPostUpdateBody, APIPostUpdateResult, APIPostsBrowseQueryParams, APIPostsBrowseResult, APIProductBatchBody, APIProductBatchResult, APIProductCreateBody, APIProductCreateResult, APIProductDeleteQueryParams, APIProductDeleteResult, APIProductFiltersResult, APIProductGetByIdParams, APIProductGetByIdQueryParams, APIProductGetByIdResult, APIProductReviewCreateBody, APIProductReviewCreateResult, APIProductReviewsBrowseQueryParams, APIProductReviewsBrowseResult, APIProductUpdateBody, APIProductUpdateQueryParams, APIProductUpdateResult, APIProductsBrowseQueryParams, APIProductsBrowseResult, APISearchQueryParams, APISearchResult, APISocialsGetResult, APISubscriberCreateBody, APISubscriberCreateResult, APISubscriberDeleteResult, APIVariantCreateBody, APIVariantCreateResult, APIVariantGetByIdParams, APIVariantGetByIdQueryParams, APIVariantGetByIdResult, APIVariantUpdateBody, APIVariantUpdateResult, JSONContent };
8076
+ export type { APIBlogCategoriesBrowseQueryParams, APIBlogCategoriesBrowseResult, APIBlogCategoryCreateBody, APIBlogCategoryCreateResult, APIBlogCategoryDeleteResult, APIBlogCategoryGetByIdParams, APIBlogCategoryGetByIdResult, APIBlogCategoryUpdateBody, APIBlogCategoryUpdateResult, APIBrandAssignProductsBody, APIBrandAssignProductsResult, APIBrandCreateBody, APIBrandCreateResult, APIBrandDeleteResult, APIBrandGetByIdParams, APIBrandGetByIdResult, APIBrandUpdateBody, APIBrandUpdateResult, APIBrandsBrowseQueryParams, APIBrandsBrowseResult, APICartAddBody, APICartAddResult, APICartCreateBody, APICartCreateResult, APICartDeleteResult, APICartGetResult, APICartRemoveItemQueryParams, APICartRemoveItemResult, APICategoriesBrowseQueryParams, APICategoriesBrowseResult, APICategoryCreateBody, APICategoryCreateResult, APICategoryDeleteResult, APICategoryGetByIdParams, APICategoryGetByIdQueryParams, APICategoryGetByIdResult, APICategoryUpdateBody, APICategoryUpdateQueryParams, APICategoryUpdateResult, APICollectionCreateBody, APICollectionCreateResult, APICollectionDeleteResult, APICollectionGetByIdParams, APICollectionGetByIdQueryParams, APICollectionGetByIdResult, APICollectionUpdateBody, APICollectionUpdateResult, APICollectionsBrowseQueryParams, APICollectionsBrowseResult, APIContactMessageCreateBody, APIContactMessageCreateResult, APICustomerAddressCreateBody, APICustomerAddressCreateResult, APICustomerGetByIdParams, APICustomerGetByIdResult, APICustomerOrdersBrowseQueryParams, APICustomerOrdersBrowseResult, APICustomerUpdateBody, APICustomerUpdateResult, APICustomersBrowseQueryParams, APICustomersBrowseResult, APIEventAttendeesBrowseResult, APIEventCreateBody, APIEventCreateResult, APIEventGetByIdParams, APIEventGetByIdResult, APIEventUpdateBody, APIEventUpdateResult, APIEventsBrowseQueryParams, APIEventsBrowseResult, APIInstaviewImagesBrowseParams, APIInstaviewImagesBrowseQueryParams, APIInstaviewImagesBrowseResult, APIInventoryAdjustBody, APIInventoryAdjustResult, APIInventoryBrowseQueryParams, APIInventoryBrowseResult, APILegalPageGetByPathResult, APILegalPagesBrowseResult, APIMeGetResult, APIOrderGetByIdParams, APIOrderGetByIdResult, APIOrderRefundGetParams, APIOrderRefundGetResult, APIOrderRefundsBrowseQueryParams, APIOrderRefundsBrowseResult, APIOrderRefundsParams, APIOrderUpdateBody, APIOrderUpdateResult, APIOrdersBrowseQueryParams, APIOrdersBrowseResult, APIPostCommentCreateBody, APIPostCommentCreateResult, APIPostCommentsBrowseQueryParams, APIPostCommentsBrowseResult, APIPostCreateBody, APIPostCreateResult, APIPostDeleteResult, APIPostGetByIdParams, APIPostGetByIdResult, APIPostUpdateBody, APIPostUpdateResult, APIPostsBrowseQueryParams, APIPostsBrowseResult, APIProductBatchBody, APIProductBatchResult, APIProductCreateBody, APIProductCreateResult, APIProductDeleteQueryParams, APIProductDeleteResult, APIProductFiltersResult, APIProductGetByIdParams, APIProductGetByIdQueryParams, APIProductGetByIdResult, APIProductReviewCreateBody, APIProductReviewCreateResult, APIProductReviewsBrowseQueryParams, APIProductReviewsBrowseResult, APIProductUpdateBody, APIProductUpdateQueryParams, APIProductUpdateResult, APIProductsBrowseQueryParams, APIProductsBrowseResult, APISearchQueryParams, APISearchResult, APISocialsGetResult, APISubscriberCreateBody, APISubscriberCreateResult, APISubscriberDeleteResult, APIVariantCreateBody, APIVariantCreateResult, APIVariantGetByIdParams, APIVariantGetByIdQueryParams, APIVariantGetByIdResult, APIVariantUpdateBody, APIVariantUpdateResult, JSONContent };
package/dist/browser.d.ts CHANGED
@@ -1,2 +1 @@
1
- export { mountFeedbackToolbar } from './feedback-toolbar.js';
2
1
  export { startSandboxInspectors } from './sandbox-inspectors.js';
package/dist/browser.js CHANGED
@@ -1,5 +1,2 @@
1
- import{useEffect as $,useRef as B,useState as C}from"react";import{createRoot as we}from"react-dom/client";import{Fragment as he,jsx as i,jsxs as b}from"react/jsx-runtime";var V="yns-feedback-toolbar-root",ne={todo:"Open",in_progress:"In progress",done:"Resolved",wont_fix:"Won't fix"},xe=()=>{if(typeof window>"u")return null;let e=(process.env.NEXT_PUBLIC_YNS_API_BASE??"").trim();if(e)return e.replace(/\/$/,"");let n=window.location.hostname,t=window.location.protocol;return n.endsWith(".yns.store")?`${t}//yns.store`:n.endsWith(".yns.cx")?`${t}//yns.cx`:window.location.origin},Ce=e=>{if(e.id)return`#${CSS.escape(e.id)}`;let n=[],t=e;for(;t&&t.nodeType===Node.ELEMENT_NODE&&n.length<6;){let o=t.tagName.toLowerCase(),s=t.getAttribute("class");if(s){let l=s.split(/\s+/).filter(Boolean).slice(0,2).map(c=>`.${CSS.escape(c)}`).join("");o+=l}let a=t.parentElement,d=t.tagName;if(a){let l=Array.from(a.children).filter(c=>c.tagName===d);if(l.length>1){let c=l.indexOf(t)+1;o+=`:nth-of-type(${c})`}}n.unshift(o),t=a}return n.join(" > ")},ke=["id","class","data-testid","aria-label","role","name","href","src"],K=e=>{let n=[];for(let t of ke){let o=e.getAttribute(t);if(!o)continue;let s=o.length>80?`${o.slice(0,80)}\u2026`:o;n.push(` ${t}="${s.replace(/"/g,"&quot;")}"`)}return n.join("")},oe=e=>{let n=(e.textContent??"").replace(/\s+/g," ").trim();return n?n.length>100?`${n.slice(0,100)}\u2026`:n:""},Ee=e=>{let n=[],t=e;for(;t&&t!==document.documentElement&&n.length<5;){let c=t.parentElement;if(!c)break;n.unshift(c),t=c}let o=[],s=0;for(let c of n){let m=" ".repeat(s);o.push(`${m}<${c.tagName.toLowerCase()}${K(c)}>`),s++}let a=" ".repeat(s),d=e.tagName.toLowerCase(),l=oe(e);if(o.push(`${a}<${d}${K(e)}>${l?`${l}</${d}>`:""} \u2190 TARGET`),!l){let c=" ".repeat(s+1),m=Array.from(e.children).slice(0,6);for(let v of m){let k=oe(v);o.push(`${c}<${v.tagName.toLowerCase()}${K(v)}>${k?`${k}</${v.tagName.toLowerCase()}>`:""}`)}e.children.length>6&&o.push(`${c}\u2026 (${e.children.length-6} more children)`),o.push(`${a}</${d}>`)}for(let c=n.length-1;c>=0;c--){let m=" ".repeat(c),v=n[c];v&&o.push(`${m}</${v.tagName.toLowerCase()}>`)}return o.join(`
2
- `)},ie=e=>{let n=e;for(;n;){if(n instanceof HTMLElement&&n.dataset.ynsFeedbackUi==="true")return!0;n=n.parentElement}return!1},Pe=new Set(["HTML","HEAD","SCRIPT","STYLE","NOSCRIPT"]),Re=1e4,Ae=3e4,Le=e=>typeof e=="object"&&e!==null&&"viewer"in e&&(e.viewer==="anonymous"||e.viewer==="non-member"||e.viewer==="member"),Ie=e=>{let n=new Date(e),t=n.getTime()-Date.now(),o=n.toLocaleString(void 0,{weekday:"short",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"});if(t<=0)return`Any moment now (estimated by ${o})`;let s=Math.ceil(t/6e4);if(s<60)return`~${s} minutes (by ${o})`;let a=Math.round(t/36e5);if(a<24)return`~${a} ${a===1?"hour":"hours"} (by ${o})`;let d=Math.round(t/864e5);return`~${d} ${d===1?"day":"days"} (by ${o})`};async function se(e,n){try{let t=await fetch(`${e}/api/auth/sign-out`,{method:"POST",credentials:"include"});t.ok||console.warn("[YNS Feedback Toolbar] sign-out responded non-OK",t.status)}catch(t){console.warn("[YNS Feedback Toolbar] sign-out fetch failed",t)}n()}function $e(){let[e,n]=C(null),[t,o]=C(!0),[s,a]=C(!1),[d,l]=C(null),[c,m]=C(null),[v,k]=C(!1),[E,w]=C(!1),u=B(null),g=B(()=>{});$(()=>{if(u.current=xe(),!u.current){o(!1);return}let r=!1,f=null,y=0,S=null,A=null,P=()=>{S!==null&&(window.clearTimeout(S),S=null)},I=(N,F)=>{r||F<y||(A=N?.viewer??null,n(N),o(!1))},T=()=>{if(r)return;let N=A==="member"?Re:Ae;S=window.setTimeout(()=>{H()},N)},H=async()=>{if(r)return;f?.abort();let N=new AbortController;f=N;let F=++y;try{let _=await fetch(`${u.current}/api/feedback-comments?host=${encodeURIComponent(window.location.host)}`,{credentials:"include",signal:N.signal});if(r||F<y)return;if(_.status===404||!_.ok){I(null,F),T();return}let te=await _.json();if(r||F<y)return;if(!Le(te)){I(null,F),T();return}I(te,F),T()}catch(_){if(_?.name==="AbortError"||r)return;I(null,F),T()}},Z=()=>{r||(P(),H())};g.current=Z;let ee=()=>{document.hidden?(f?.abort(),P()):Z()};return document.addEventListener("visibilitychange",ee),H(),()=>{r=!0,document.removeEventListener("visibilitychange",ee),f?.abort(),P(),g.current=()=>{}}},[]);let p=e?.viewer==="member"?e:null;$(()=>{!p||p.canComment||(a(!1),l(null),k(!1),m(null))},[p]),$(()=>{if(s)return document.body.style.cursor="crosshair",()=>{document.body.style.cursor=""}},[s]),$(()=>{if(!s)return;let r=document.createElement("div");r.dataset.ynsFeedbackUi="true",r.style.cssText=["position: fixed","pointer-events: none","z-index: 2147483644","border: 2px dashed #10b981","background: rgba(16, 185, 129, 0.08)","border-radius: 3px","display: none","transition: top 0.05s, left 0.05s, width 0.05s, height 0.05s"].join(";");let f=document.createElement("div");f.dataset.ynsFeedbackUi="true",f.textContent="Click to comment",f.style.cssText=["position: fixed","pointer-events: none","z-index: 2147483645","background: #059669","color: #fff","font-size: 11px","font-family: ui-sans-serif, system-ui, sans-serif","padding: 3px 8px","border-radius: 4px","white-space: nowrap","display: none","box-shadow: 0 2px 6px rgba(0,0,0,0.15)"].join(";"),document.documentElement.appendChild(r),document.documentElement.appendChild(f);let y=null,S=P=>{let I=document.elementFromPoint(P.clientX,P.clientY);if(!I||Pe.has(I.tagName)||ie(I)){r.style.display="none",f.style.display="none",y=null;return}y=I,requestAnimationFrame(()=>{if(y!==I)return;let T=I.getBoundingClientRect();r.style.top=`${T.top}px`,r.style.left=`${T.left}px`,r.style.width=`${T.width}px`,r.style.height=`${T.height}px`,r.style.display="block",f.style.left=`${P.clientX+14}px`,f.style.top=`${P.clientY+14}px`,f.style.display="block"})},A=()=>{r.style.display="none",f.style.display="none",y=null};return document.addEventListener("mousemove",S,!0),document.addEventListener("mouseleave",A),()=>{document.removeEventListener("mousemove",S,!0),document.removeEventListener("mouseleave",A),r.remove(),f.remove()}},[s]),$(()=>{if(!s)return;let r=f=>{let y=f.target;if(!(y instanceof Element)||ie(y))return;f.preventDefault(),f.stopPropagation();let S=y.getBoundingClientRect(),A=S.width>0?(f.clientX-S.left)/S.width:.5,P=S.height>0?(f.clientY-S.top)/S.height:.5;l({cssSelector:Ce(y),pagePath:window.location.pathname,surroundingHtml:Ee(y),rect:{top:S.top+window.scrollY,left:S.left+window.scrollX,width:S.width,height:S.height},clickX:f.clientX+window.scrollX,clickY:f.clientY+window.scrollY,offsetXRatio:Math.min(1,Math.max(0,A)),offsetYRatio:Math.min(1,Math.max(0,P))}),a(!1)};return document.addEventListener("click",r,{capture:!0}),()=>document.removeEventListener("click",r,{capture:!0})},[s]);let h=()=>{g.current()},R=async(r,f)=>{!u.current||!p||!d||!(await fetch(`${u.current}/api/feedback-comments`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({feedbackSessionId:p.feedbackSessionId,content:r,pagePath:d.pagePath,cssSelector:d.cssSelector,surroundingHtml:d.surroundingHtml,offsetXRatio:d.offsetXRatio,offsetYRatio:d.offsetYRatio,...f.length>0?{attachments:f}:{}})})).ok||(l(null),a(!0),h())},z=async(r,f,y)=>{!u.current||!(await fetch(`${u.current}/api/feedback-comments/${r}`,{method:"PATCH",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:f,attachments:y})})).ok||(m(null),h())},W=async r=>{!u.current||!(await fetch(`${u.current}/api/feedback-comments/${r}`,{method:"DELETE",credentials:"include"})).ok||h()},Y=async(r,f)=>{!u.current||!(await fetch(`${u.current}/api/feedback-comments/${r}`,{method:"PATCH",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:f})})).ok||h()},X=async(r,f)=>{!u.current||!(await fetch(`${u.current}/api/feedback-comments/${r}/replies`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:f})})).ok||h()},x=async()=>{if(!(!u.current||!p)&&window.confirm(rt(p))){w(!0);try{let r=await fetch(`${u.current}/api/feedback-sessions/${p.feedbackSessionId}/finalize`,{method:"POST",credentials:"include"});if(!r.ok)return;let y=(await r.json().catch(()=>null))?.status??"processing";n(S=>S?.viewer==="member"?{...S,canComment:!1,sessionStatus:y}:S)}finally{w(!1)}}},L=r=>{if(r.pagePath!==window.location.pathname){window.location.assign(r.pagePath);return}let f=null;try{f=document.querySelector(r.cssSelector)}catch{f=null}f&&(f.scrollIntoView({behavior:"smooth",block:"center"}),m(r.id))};if(t||!e)return null;if(e.viewer==="anonymous")return i(lt,{loginUrl:e.loginUrl});if(e.viewer==="non-member")return i(dt,{user:e.user,onSignOut:()=>{u.current&&se(u.current,()=>g.current())}});if(!p)return null;if(!p.canComment)return p.sessionStatus!=="processing"&&p.sessionStatus!=="in_review"?null:i("div",{"data-yns-feedback-ui":"true",children:i(Te,{progress:p.progress,eta:p.eta,status:p.sessionStatus})});let M=p.comments.filter(r=>r.pagePath===window.location.pathname&&r.status!=="done"&&r.status!=="wont_fix");return b("div",{"data-yns-feedback-ui":"true",children:[M.map((r,f)=>i(Ne,{pin:r,number:f+1,editing:c===r.id,feedbackSessionId:p.feedbackSessionId,apiBase:u.current,onStartEdit:()=>m(r.id),onCancelEdit:()=>m(null),onSave:(y,S)=>z(r.id,y,S),onRemove:()=>W(r.id),onReply:y=>X(r.id,y),onStatusChange:y=>Y(r.id,y)},r.id)),d&&i(_e,{pending:d,feedbackSessionId:p.feedbackSessionId,apiBase:u.current,onCancel:()=>{l(null),a(!0)},onSave:(r,f)=>R(r,f)}),v&&i(Be,{comments:p.comments,currentPath:window.location.pathname,onClose:()=>k(!1),onSelect:L}),b("div",{style:G,children:[i("button",{type:"button",onClick:()=>a(r=>!r),style:s?De:j,children:s?"Cancel":"Add comment"}),i("button",{type:"button",onClick:()=>k(r=>!r),style:We,children:v?"Hide list":`List (${p.comments.length})`}),i("button",{type:"button",onClick:x,disabled:E,style:Ye,children:E?"Finalizing\u2026":"Finalize"}),i("span",{style:J,children:s?"Click any element to comment":`${M.length} on this page`}),i(at,{authors:p.authors,viewerId:p.user.id}),i(ct,{user:p.user,onSignOut:()=>{u.current&&se(u.current,()=>g.current())}})]})]})}function Te({progress:e,eta:n,status:t}){let[,o]=C(0);$(()=>{let l=window.setInterval(()=>o(c=>c+1),6e4);return()=>window.clearInterval(l)},[]);let s=Ie(n);return b("div",{style:Rt,children:[i("style",{children:Me}),b("div",{style:At,children:[i(Fe,{}),i("span",{style:Lt,children:"Submitted"}),i("strong",{style:{fontSize:13},children:t==="in_review"?"Feedback under review":"Applying feedback"})]}),b("div",{style:It,children:[i("span",{children:"Review progress"}),i("span",{style:{opacity:.7},children:e.label})]}),i("div",{style:$t,children:i("div",{style:{...Tt,width:`${e.fillPct}%`}})}),b("p",{style:Mt,children:["Estimated delivery: ",i("span",{style:{fontWeight:600},children:s})]})]})}var Me="@keyframes yns-feedback-spin { to { transform: rotate(360deg); } }";function Fe({size:e=14}){return i("span",{"aria-hidden":!0,style:{display:"inline-block",width:e,height:e,border:"2px solid rgba(16, 185, 129, 0.25)",borderTopColor:"#10b981",borderRadius:999,animation:"yns-feedback-spin 0.9s linear infinite"}})}function re({comment:e,onReply:n,onStatusChange:t}){let[o,s]=C(""),[a,d]=C(!1),l=e.replies??[],c=async()=>{let m=o.trim();if(!(!m||a)){d(!0);try{await n(m),s("")}finally{d(!1)}}};return b("div",{style:Ft,children:[t&&b("div",{style:Nt,children:[i("span",{style:zt,children:"Status"}),i("select",{value:e.status,onChange:m=>void t(m.target.value),style:_t,children:Object.keys(ne).map(m=>i("option",{value:m,children:ne[m]},m))})]}),l.length>0&&i("div",{style:Bt,children:l.map(m=>b("div",{style:Ot,children:[i("span",{style:jt,children:m.authorKind==="system"?"System":m.author?.name||m.author?.email||"Reviewer"}),i("span",{style:Ut,children:m.content})]},m.id))}),b("div",{style:Dt,children:[i("textarea",{value:o,onChange:m=>s(m.target.value),placeholder:"Reply\u2026",rows:2,style:ue,onKeyDown:m=>{m.key==="Enter"&&!m.shiftKey&&(m.preventDefault(),c())}}),i("button",{type:"button",onClick:()=>void c(),style:me,disabled:a||!o.trim(),children:a?"\u2026":"Reply"})]})]})}function Ne({pin:e,number:n,editing:t,feedbackSessionId:o,apiBase:s,onStartEdit:a,onCancelEdit:d,onSave:l,onRemove:c,onReply:m,onStatusChange:v}){let k=Ue(e.cssSelector,e.offsetXRatio,e.offsetYRatio);if(!k)return null;let E=e.canMutate!==!1;return b("div",{style:{position:"absolute",top:k.top,left:k.left,zIndex:2147483600,pointerEvents:"auto"},children:[i("button",{type:"button",onClick:a,style:de,title:e.content,children:n}),e.author&&i("span",{style:Ke,title:e.author.name||e.author.email,children:i(O,{user:e.author,size:16})}),t&&(E?i(le,{initial:e.content,initialAttachments:e.attachments,feedbackSessionId:o,apiBase:s,onCancel:d,onSave:l,onRemove:c,thread:i(re,{comment:e,onReply:m,onStatusChange:v})}):i(ze,{comment:e,onClose:d,thread:i(re,{comment:e,onReply:m})}))]})}function ze({comment:e,onClose:n,thread:t}){return b("div",{style:ce,children:[e.author&&b("div",{style:qe,children:[i(O,{user:e.author,size:20}),i("span",{style:Ge,children:e.author.name||e.author.email})]}),i("div",{style:Je,children:e.content}),e.attachments.length>0&&i("div",{style:fe,children:e.attachments.map(o=>i("a",{href:o.url,target:"_blank",rel:"noreferrer",style:ge,children:i("img",{src:o.url,alt:"",style:ye})},o.url))}),t,b("div",{style:pe,children:[i("span",{style:{flex:1,fontSize:12,color:"#6b7280"},children:"Only the author can edit"}),i("button",{type:"button",onClick:n,style:Q,children:"Close"})]})]})}function _e({pending:e,feedbackSessionId:n,apiBase:t,onCancel:o,onSave:s}){return b(he,{children:[i("div",{style:{position:"absolute",top:e.rect.top+e.rect.height*e.offsetYRatio-12,left:e.rect.left+e.rect.width*e.offsetXRatio-12,zIndex:2147483600,pointerEvents:"none"},children:i("div",{style:de,children:"\u2022"})}),i("div",{style:{position:"absolute",top:e.clickY+10,left:e.clickX+10,zIndex:2147483647},children:i(le,{initial:"",initialAttachments:[],feedbackSessionId:n,apiBase:t,onCancel:o,onSave:s})})]})}function Be({comments:e,currentPath:n,onClose:t,onSelect:o}){let s=new Map;for(let d of e){let l=s.get(d.pagePath)??[];l.push(d),s.set(d.pagePath,l)}let a=Array.from(s.keys()).sort((d,l)=>d===n?-1:l===n?1:d.localeCompare(l));return b("div",{style:bt,children:[b("div",{style:ht,children:[b("strong",{style:{fontSize:14},children:["Comments (",e.length,")"]}),i("button",{type:"button",onClick:t,style:Q,children:"Close"})]}),i("div",{style:St,children:e.length===0?i("div",{style:vt,children:"No comments yet. Click \u201CAdd comment\u201D to leave one."}):a.map(d=>b("div",{style:{marginBottom:12},children:[i("div",{style:wt,children:d===n?`${d} \xB7 current`:d}),(s.get(d)??[]).map((l,c)=>b("button",{type:"button",onClick:()=>o(l),style:xt,disabled:l.status==="done"&&!1,children:[i("span",{style:Ct,children:c+1}),b("span",{style:kt,children:[l.author&&i("span",{style:Et,children:l.author.name||l.author.email}),l.content.length>140?`${l.content.slice(0,140)}\u2026`:l.content]}),l.status==="done"&&i("span",{style:Pt,children:"done"})]},l.id))]},d))})]})}var q=5,Oe=5*1024*1024,je=e=>new Promise(n=>{let t=URL.createObjectURL(e),o=new window.Image;o.onload=()=>{URL.revokeObjectURL(t),n({width:o.naturalWidth,height:o.naturalHeight})},o.onerror=()=>{URL.revokeObjectURL(t),n(null)},o.src=t});function le({initial:e,initialAttachments:n,feedbackSessionId:t,apiBase:o,onCancel:s,onSave:a,onRemove:d,thread:l}){let[c,m]=C(e),[v,k]=C(n),[E,w]=C(!1),[u,g]=C(!1),[p,h]=C(null),R=B(null),z=B(null);$(()=>{let x=R.current;if(!x)return;x.focus();let L=x.value.length;x.setSelectionRange(L,L)},[]);let W=async x=>{x.preventDefault();let L=c.trim();if(L){w(!0);try{await a(L,v)}finally{w(!1)}}},Y=async x=>{if(!x||x.length===0||!o)return;h(null);let L=q-v.length;if(L<=0){h(`Max ${q} images per comment`);return}let M=Array.from(x).slice(0,L);for(let r of M){if(!r.type.startsWith("image/")){h(`"${r.name}" is not an image`);return}if(r.size>Oe){h(`"${r.name}" exceeds 5 MB`);return}}g(!0);try{let r=await Promise.all(M.map(je)),f=new FormData;M.forEach((A,P)=>{f.append("file",A),f.append("width",r[P]?.width?String(r[P]?.width):""),f.append("height",r[P]?.height?String(r[P]?.height):"")});let y=await fetch(`${o}/api/feedback-comments/uploads?feedbackSessionId=${encodeURIComponent(t)}`,{method:"POST",credentials:"include",body:f});if(!y.ok){let A=await y.json().catch(()=>null);h(A?.error??"Upload failed");return}let S=await y.json();k(A=>[...A,...S.uploads])}catch{h("Upload failed")}finally{g(!1),z.current&&(z.current.value="")}},X=x=>{k(L=>L.filter(M=>M.url!==x))};return b("form",{onSubmit:W,style:ce,children:[i("textarea",{ref:R,value:c,onChange:x=>m(x.target.value),placeholder:"Leave a comment\u2026",style:ue,rows:3}),v.length>0&&i("div",{style:fe,children:v.map(x=>b("div",{style:ge,children:[i("img",{src:x.url,alt:"",style:ye}),i("button",{type:"button",onClick:()=>X(x.url),style:Ze,disabled:E||u,"aria-label":"Remove attachment",children:"\xD7"})]},x.url))}),p&&i("div",{style:et,children:p}),i("input",{ref:z,type:"file",accept:"image/*",multiple:!0,onChange:x=>void Y(x.target.files),style:{display:"none"}}),b("div",{style:pe,children:[d&&i("button",{type:"button",onClick:()=>d(),style:Qe,disabled:E,children:"Delete"}),i("button",{type:"button",onClick:()=>z.current?.click(),style:tt,disabled:E||u||v.length>=q,"aria-label":u?"Uploading\u2026":"Attach image",title:u?"Uploading\u2026":"Attach image",children:u?i(ot,{}):i(nt,{})}),i("div",{style:{flex:1}}),i("button",{type:"button",onClick:s,style:Q,disabled:E,children:"Cancel"}),i("button",{type:"submit",style:me,disabled:E||u||!c.trim(),children:E?"Saving\u2026":"Save"})]}),l]})}function Ue(e,n,t){let[o,s]=C(null);return $(()=>{let a=()=>{let l=null;try{l=document.querySelector(e)}catch{l=null}if(!l){s(null);return}let c=l.getBoundingClientRect();s({top:c.top+window.scrollY+c.height*t-12,left:c.left+window.scrollX+c.width*n-12})};a();let d=new ResizeObserver(a);try{let l=document.querySelector(e);l&&d.observe(l)}catch{}return window.addEventListener("scroll",a,!0),window.addEventListener("resize",a),()=>{d.disconnect(),window.removeEventListener("scroll",a,!0),window.removeEventListener("resize",a)}},[e,n,t]),o}var G={position:"fixed",bottom:16,left:"50%",transform:"translateX(-50%)",zIndex:2147483646,display:"flex",alignItems:"center",gap:8,padding:"8px 12px",background:"rgba(17, 17, 17, 0.92)",color:"white",borderRadius:999,boxShadow:"0 8px 24px rgba(0,0,0,0.25)",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"',fontSize:14,pointerEvents:"auto"},j={border:"none",background:"white",color:"#111",padding:"6px 12px",borderRadius:999,cursor:"pointer",fontWeight:600,fontSize:13},De={...j,background:"#ef4444",color:"white"},We={border:"1px solid rgba(255,255,255,0.4)",background:"transparent",color:"white",padding:"6px 12px",borderRadius:999,cursor:"pointer",fontWeight:500,fontSize:13},Ye={border:"none",background:"#10b981",color:"white",padding:"6px 12px",borderRadius:999,cursor:"pointer",fontWeight:600,fontSize:13},J={opacity:.8,fontSize:12},Xe={display:"inline-flex",alignItems:"center",paddingLeft:4},He={marginLeft:-6,display:"inline-flex",borderRadius:999,boxShadow:"0 0 0 2px rgba(17, 17, 17, 0.92)"},Ve={marginLeft:-2,padding:"0 6px",height:18,minWidth:18,borderRadius:999,background:"rgba(255,255,255,0.18)",color:"white",fontSize:10,fontWeight:600,display:"inline-flex",alignItems:"center",justifyContent:"center"},de={width:24,height:24,borderRadius:999,background:"#10b981",color:"white",border:"2px solid white",cursor:"pointer",fontSize:12,fontWeight:700,boxShadow:"0 2px 6px rgba(0,0,0,0.3)",display:"inline-flex",alignItems:"center",justifyContent:"center",padding:0},Ke={position:"absolute",bottom:-6,right:-6,width:20,height:20,borderRadius:999,border:"2px solid white",background:"#111",display:"inline-flex",alignItems:"center",justifyContent:"center",boxShadow:"0 1px 3px rgba(0,0,0,0.3)",pointerEvents:"none"},qe={display:"flex",alignItems:"center",gap:8},Ge={fontSize:13,fontWeight:600,color:"#111"},Je={fontSize:14,color:"#111",whiteSpace:"pre-wrap",wordBreak:"break-word"},ce={background:"white",border:"1px solid #e5e7eb",borderRadius:8,padding:12,width:280,boxShadow:"0 12px 32px rgba(0,0,0,0.18)",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"',display:"flex",flexDirection:"column",gap:8,color:"#111"},ue={width:"100%",border:"1px solid #d1d5db",borderRadius:6,padding:8,fontSize:14,resize:"vertical",fontFamily:"inherit",color:"#111",background:"white",boxSizing:"border-box"},pe={display:"flex",alignItems:"center",gap:6},U={border:"1px solid transparent",borderRadius:6,padding:"6px 10px",fontSize:13,cursor:"pointer",fontWeight:500},me={...U,background:"#111",color:"white"},Q={...U,background:"transparent",color:"#374151",borderColor:"#d1d5db"},Qe={...U,background:"transparent",color:"#b91c1c",borderColor:"#fecaca"},fe={display:"flex",flexWrap:"wrap",gap:6},ge={position:"relative",width:56,height:56,borderRadius:6,overflow:"hidden",border:"1px solid #e5e7eb",background:"#f9fafb"},ye={width:"100%",height:"100%",objectFit:"cover",display:"block"},Ze={position:"absolute",top:2,right:2,width:18,height:18,borderRadius:999,border:"none",background:"rgba(17, 17, 17, 0.85)",color:"white",fontSize:13,lineHeight:"16px",cursor:"pointer",padding:0,display:"inline-flex",alignItems:"center",justifyContent:"center"},et={color:"#b91c1c",fontSize:12,margin:0},tt={...U,background:"transparent",color:"#374151",borderColor:"#d1d5db",width:30,height:30,padding:0,display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0};function nt(){return b("svg",{role:"img","aria-label":"Attach image",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[i("title",{children:"Attach image"}),i("path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 17.93 8.83l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"})]})}function ot(){return b(he,{children:[i("style",{children:"@keyframes yns-attach-spin { to { transform: rotate(360deg); } }"}),i("span",{"aria-hidden":!0,style:{display:"inline-block",width:12,height:12,border:"2px solid rgba(55, 65, 81, 0.25)",borderTopColor:"#374151",borderRadius:999,animation:"yns-attach-spin 0.9s linear infinite"}})]})}var it=480;function be(){let[e,n]=C(!1);return $(()=>{let t=window.matchMedia(`(max-width: ${it}px)`),o=()=>n(t.matches);return o(),t.addEventListener("change",o),()=>t.removeEventListener("change",o)},[]),e}var st=e=>{let n=e.name?.trim();return n?n.split(/\s+/).filter(Boolean).slice(0,2).map(o=>o[0]?.toUpperCase()??"").join(""):e.email[0]?.toUpperCase()??"?"};function O({user:e,size:n=22}){return e.image?i("img",{src:e.image,alt:"",width:n,height:n,style:{width:n,height:n,borderRadius:999,objectFit:"cover",display:"block",flexShrink:0}}):i("span",{"aria-hidden":!0,style:{width:n,height:n,borderRadius:999,background:"rgba(255,255,255,0.18)",color:"white",display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:Math.max(10,Math.round(n*.45)),fontWeight:600,flexShrink:0},children:st(e)})}function rt(e){let n=e.authors??[],t=e.anonymousCount??0,o=e.commentTotal;if(o===0)return"Finalize this feedback session with zero comments? It will be canceled instead of submitted.";if(n.length===0&&t===0)return`Finalize this feedback session with ${o} comment${o===1?"":"s"}? You won't be able to add more.`;let s=n.length+(t>0?1:0),a=n.map(l=>l.name||l.email);t>0&&a.push(`${t} anonymous`);let d=a.length===1?a[0]:`${a.slice(0,-1).join(", ")} and ${a.at(-1)}`;return`Submit ${o} comment${o===1?"":"s"} from ${s} reviewer${s===1?"":"s"} (${d})?
3
-
4
- This sends ALL comments \u2014 including those from other reviewers \u2014 for AI processing. You won't be able to add more comments after finalizing.`}function at({authors:e,viewerId:n}){if(!e||e.length===0)return null;let t=e.filter(a=>a.id!==n);if(t.length===0)return null;let o=t.slice(0,3),s=t.length-o.length;return b("div",{style:Xe,title:`Also commenting: ${t.map(a=>`${a.name||a.email} (${a.commentCount})`).join(", ")}`,children:[o.map(a=>i("span",{style:He,children:i(O,{user:a,size:18})},a.id)),s>0&&b("span",{style:Ve,children:["+",s]})]})}function lt({loginUrl:e}){return i("div",{"data-yns-feedback-ui":"true",children:b("div",{style:G,children:[i("span",{style:J,children:"Log in to provide feedback"}),i("button",{type:"button",onClick:()=>window.location.assign(e),style:j,children:"Log in"})]})})}function dt({user:e,onSignOut:n}){let t=be();return i("div",{"data-yns-feedback-ui":"true",children:b("div",{style:G,children:[i(O,{user:e}),!t&&i("span",{style:ut,children:e.email}),i("span",{style:J,children:"You don't have access to this store"}),i("button",{type:"button",onClick:n,style:j,children:"Sign out"})]})})}function ct({user:e,onSignOut:n}){let[t,o]=C(!1),s=B(null),a=be();$(()=>{if(!t)return;let c=m=>{s.current&&(m.target instanceof Node&&s.current.contains(m.target)||o(!1))};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[t]);let d=e.name?.trim()||e.email,l=d.length>16?`${d.slice(0,16)}\u2026`:d;return b("div",{ref:s,style:{position:"relative"},children:[b("button",{type:"button",onClick:()=>o(c=>!c),style:pt,"aria-haspopup":"menu","aria-expanded":t,title:d,children:[i(O,{user:e,size:20}),!a&&i("span",{style:mt,children:l}),i("span",{"aria-hidden":!0,style:ft,children:"\u25BE"})]}),t&&i("div",{role:"menu",style:gt,children:i("button",{type:"button",role:"menuitem",onClick:()=>{o(!1),n()},style:yt,children:"Sign out"})})]})}var ut={fontSize:13,color:"white",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",maxWidth:200},pt={display:"inline-flex",alignItems:"center",gap:6,background:"rgba(255,255,255,0.08)",border:"1px solid rgba(255,255,255,0.16)",color:"white",padding:"4px 8px 4px 4px",borderRadius:999,cursor:"pointer",fontSize:12,fontWeight:500,fontFamily:"inherit"},mt={maxWidth:"16ch",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},ft={opacity:.7,fontSize:10},gt={position:"absolute",right:0,bottom:"calc(100% + 8px)",background:"white",color:"#111",border:"1px solid #e5e7eb",borderRadius:8,boxShadow:"0 12px 32px rgba(0,0,0,0.18)",minWidth:140,padding:4,zIndex:2147483647},yt={display:"block",width:"100%",textAlign:"left",background:"transparent",border:"none",padding:"6px 10px",fontSize:13,color:"#111",cursor:"pointer",borderRadius:6},bt={position:"fixed",top:0,right:0,bottom:0,width:360,maxWidth:"92vw",background:"white",borderLeft:"1px solid #e5e7eb",boxShadow:"-12px 0 32px rgba(0,0,0,0.12)",zIndex:2147483646,display:"flex",flexDirection:"column",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"',color:"#111"},ht={display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid #e5e7eb"},St={flex:1,overflow:"auto",padding:"12px 12px 24px"},vt={color:"#6b7280",fontSize:13,padding:"24px 8px",textAlign:"center"},wt={fontSize:11,textTransform:"uppercase",letterSpacing:.5,color:"#6b7280",padding:"4px 4px 6px",wordBreak:"break-all"},xt={display:"flex",alignItems:"flex-start",gap:8,width:"100%",textAlign:"left",background:"white",border:"1px solid #e5e7eb",borderRadius:6,padding:"8px 10px",cursor:"pointer",fontSize:13,marginBottom:6,color:"#111"},Ct={flexShrink:0,width:22,height:22,borderRadius:999,background:"#10b981",color:"white",fontWeight:700,fontSize:11,display:"inline-flex",alignItems:"center",justifyContent:"center"},kt={flex:1,whiteSpace:"pre-wrap",wordBreak:"break-word"},Et={display:"block",fontSize:11,fontWeight:600,color:"#6b7280",marginBottom:2},Pt={flexShrink:0,background:"#d1fae5",color:"#065f46",fontSize:11,fontWeight:600,padding:"2px 6px",borderRadius:4,alignSelf:"center"},Rt={position:"fixed",bottom:16,left:"50%",transform:"translateX(-50%)",zIndex:2147483646,display:"flex",flexDirection:"column",gap:8,padding:"12px 16px",width:"min(420px, calc(100vw - 32px))",background:"white",border:"1px solid #e5e7eb",borderRadius:12,boxShadow:"0 12px 32px rgba(0,0,0,0.18)",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"',color:"#111",pointerEvents:"auto"},At={display:"flex",alignItems:"center",gap:8},Lt={background:"#d1fae5",color:"#065f46",fontSize:11,fontWeight:700,padding:"2px 8px",borderRadius:999,textTransform:"uppercase",letterSpacing:.5},It={display:"flex",justifyContent:"space-between",fontSize:12},$t={width:"100%",height:6,background:"#f3f4f6",borderRadius:999,overflow:"hidden"},Tt={height:"100%",background:"#10b981",borderRadius:999,transition:"width 500ms"},Mt={margin:0,fontSize:12,color:"#6b7280"},Ft={display:"flex",flexDirection:"column",gap:8,borderTop:"1px solid #e5e7eb",paddingTop:8,marginTop:2},Nt={display:"flex",alignItems:"center",gap:8},zt={fontSize:12,fontWeight:600,color:"#6b7280"},_t={flex:1,border:"1px solid #d1d5db",borderRadius:6,padding:"4px 8px",fontSize:13,color:"#111",background:"white",fontFamily:"inherit"},Bt={display:"flex",flexDirection:"column",gap:6,maxHeight:160,overflowY:"auto"},Ot={display:"flex",flexDirection:"column",gap:1,borderLeft:"2px solid #e5e7eb",paddingLeft:8},jt={fontSize:11,fontWeight:600,color:"#6b7280"},Ut={fontSize:13,color:"#111",whiteSpace:"pre-wrap",wordBreak:"break-word"},Dt={display:"flex",alignItems:"flex-end",gap:6};function ae(){if(console.log("[YNS Feedback Toolbar] mountFeedbackToolbar() called",{isWindow:typeof window<"u",vercelEnv:process.env.NEXT_PUBLIC_VERCEL_ENV,alreadyMounted:typeof document<"u"&&!!document.getElementById(V)}),typeof window>"u")return null;if(process.env.NEXT_PUBLIC_VERCEL_ENV!=="preview")return console.log("[YNS Feedback Toolbar] gate failed \u2014 NEXT_PUBLIC_VERCEL_ENV is",process.env.NEXT_PUBLIC_VERCEL_ENV),null;if(document.getElementById(V))return null;let e=document.createElement("div");e.id=V,e.dataset.ynsFeedbackUi="true",document.body.appendChild(e);let n=we(e);return n.render(i($e,{})),{unmount:()=>{n.unmount(),e.remove()}}}typeof window<"u"&&console.log("[YNS Feedback Toolbar] module evaluated",{vercelEnv:process.env.NEXT_PUBLIC_VERCEL_ENV,readyState:document.readyState,willAutoMount:process.env.NEXT_PUBLIC_VERCEL_ENV==="preview"});typeof window<"u"&&process.env.NEXT_PUBLIC_VERCEL_ENV==="preview"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{ae()}):ae());function Se(){typeof window>"u"||(console.log("[YNS Sandbox Inspectors] module evaluated"),Xt(),Ht())}Se();var Wt=new Set(["HEAD","SCRIPT","STYLE","NOSCRIPT","HTML"]);function Yt(e){if(e.id)return`${e.tagName.toLowerCase()}#${CSS.escape(e.id)}`;let n=[],t=e;for(;t&&t!==document.body&&t!==document.documentElement;){let o=t.tagName.toLowerCase();if(t.id){n.unshift(`${o}#${CSS.escape(t.id)}`);break}let s=Array.from(t.classList).filter(l=>!l.startsWith("data-yns-"));s.length>0&&(o+=`.${s.map(l=>CSS.escape(l)).join(".")}`);let a=t.parentElement,d=t.tagName;if(a&&Array.from(a.children).filter(c=>c.tagName===d&&(s.length===0||s.every(m=>c.classList.contains(m)))).length>1){let c=Array.from(a.children).indexOf(t)+1;o+=`:nth-child(${c})`}n.unshift(o),t=t.parentElement}return n.join(" > ")}function ve(e,n){let t=e.getBoundingClientRect(),o=window.getComputedStyle(e),s=(e.textContent??"").trim();return{tag:e.tagName.toLowerCase(),id:e.id||void 0,classes:Array.from(e.classList).filter(a=>!a.startsWith("data-yns-")),textContent:s.length>n?`${s.slice(0,n)}\u2026`:s,cssSelector:Yt(e),boundingRect:{top:t.top,left:t.left,width:t.width,height:t.height},computedStyles:{color:o.color,backgroundColor:o.backgroundColor,fontSize:o.fontSize,fontFamily:o.fontFamily,padding:o.padding,margin:o.margin}}}function D(e,n){if(!e?.tagName||Wt.has(e.tagName))return!0;for(let t of n)if(e.hasAttribute?.(t))return!0;return!1}function Xt(){let e=!1,n=null,t=null,o=document.createElement("div");o.setAttribute("data-yns-design-overlay","hover"),o.style.cssText=["position: fixed","pointer-events: none","z-index: 2147483646","border: 2px solid #3b82f6","background: rgba(59, 130, 246, 0.08)","border-radius: 3px","display: none","transition: top 0.05s, left 0.05s, width 0.05s, height 0.05s"].join(";");let s=document.createElement("div");s.setAttribute("data-yns-design-overlay","label"),s.style.cssText=["position: fixed","pointer-events: none","z-index: 2147483647","background: #3b82f6","color: #fff","font-size: 11px","font-family: ui-monospace, monospace","padding: 2px 6px","border-radius: 3px","white-space: nowrap","display: none"].join(";"),document.documentElement.appendChild(o),document.documentElement.appendChild(s);let a=document.createElement("style");a.setAttribute("data-yns-design-overlay","style"),a.textContent="[data-yns-selected] { outline: 2px solid #3b82f6 !important; outline-offset: 1px; }",document.head.appendChild(a);function d(w){let u=w.getBoundingClientRect();o.style.top=`${u.top}px`,o.style.left=`${u.left}px`,o.style.width=`${u.width}px`,o.style.height=`${u.height}px`,o.style.display="block";let g=Array.from(w.classList).filter(h=>!h.startsWith("data-yns-")),p=w.tagName.toLowerCase()+(g.length?`.${g[0]}`:"");s.textContent=p,s.style.left=`${u.left}px`,s.style.top=`${Math.max(0,u.top-22)}px`,s.style.display="block"}let l=w=>{let u=document.elementFromPoint(w.clientX,w.clientY);if(D(u,["data-yns-design-overlay"])){o.style.display="none",s.style.display="none",n=null;return}n=u,requestAnimationFrame(()=>{n===u&&e&&u&&d(u)})},c=()=>{o.style.display="none",s.style.display="none",n=null},m=w=>{if(!e||!n)return;w.preventDefault(),w.stopPropagation(),w.stopImmediatePropagation();let u=n;if(D(u,["data-yns-design-overlay"]))return;let g=ve(u,120),p=g.cssSelector;t&&t.el.removeAttribute("data-yns-selected"),t&&t.cssSelector===p?(t=null,window.parent.postMessage({type:"element-deselected",data:g},"*")):(t={el:u,cssSelector:p},u.setAttribute("data-yns-selected",""),window.parent.postMessage({type:"element-selected",data:g},"*"))},v=w=>{w.key==="Escape"&&e&&(E(),window.parent.postMessage({type:"design-mode-cleared"},"*"))};function k(){e=!0,document.addEventListener("mousemove",l,!0),document.addEventListener("mouseleave",c),document.addEventListener("click",m,!0),document.addEventListener("keydown",v,!0)}function E(){e=!1,document.removeEventListener("mousemove",l,!0),document.removeEventListener("mouseleave",c),document.removeEventListener("click",m,!0),document.removeEventListener("keydown",v,!0),o.style.display="none",s.style.display="none",n=null,t&&(t.el.removeAttribute("data-yns-selected"),t=null)}window.addEventListener("message",w=>{let u=w.data;!u||typeof u!="object"||(u.type==="design-mode-toggle"&&(u.enabled?k():(E(),window.parent.postMessage({type:"design-mode-cleared"},"*"))),u.type==="design-mode-deselect"&&t&&(t.el.removeAttribute("data-yns-selected"),t=null))})}function Ht(){let e=!1,n=null,t=[],o=document.createElement("div");o.setAttribute("data-yns-comment-overlay","hover"),o.style.cssText=["position: fixed","pointer-events: none","z-index: 2147483644","border: 2px dashed #10b981","background: rgba(16, 185, 129, 0.06)","border-radius: 3px","display: none","transition: top 0.05s, left 0.05s, width 0.05s, height 0.05s"].join(";");let s=document.createElement("div");s.setAttribute("data-yns-comment-overlay","cursor-label"),s.textContent="Click to comment",s.style.cssText=["position: fixed","pointer-events: none","z-index: 2147483645","background: #059669","color: #fff","font-size: 11px","font-family: ui-sans-serif, system-ui, sans-serif","padding: 3px 8px","border-radius: 4px","white-space: nowrap","display: none","box-shadow: 0 2px 6px rgba(0,0,0,0.15)"].join(";");let a=document.createElement("div");a.setAttribute("data-yns-comment-overlay","pins"),a.style.cssText="position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2147483643;",document.documentElement.appendChild(o),document.documentElement.appendChild(s),document.documentElement.appendChild(a);function d(){a.innerHTML="";for(let g of t){let p=null;try{p=document.querySelector(g.selector)}catch{p=null}if(!p)continue;let h=p.getBoundingClientRect(),R=document.createElement("div");R.style.cssText=["position: fixed",`top: ${h.top-12}px`,`left: ${h.left+h.width/2-12}px`,"width: 24px","height: 24px","border-radius: 50%","background: #059669","color: #fff","display: flex","align-items: center","justify-content: center","font-size: 12px","font-weight: 600","font-family: ui-sans-serif, system-ui, sans-serif","box-shadow: 0 2px 8px rgba(0,0,0,0.2)","pointer-events: none"].join(";"),R.textContent=String(g.number),a.appendChild(R)}}let l=g=>{let p=document.elementFromPoint(g.clientX,g.clientY);if(D(p,["data-yns-comment-overlay","data-yns-design-overlay"])){o.style.display="none",s.style.display="none",n=null;return}n=p,requestAnimationFrame(()=>{if(n===p&&e&&p){let h=p.getBoundingClientRect();o.style.top=`${h.top}px`,o.style.left=`${h.left}px`,o.style.width=`${h.width}px`,o.style.height=`${h.height}px`,o.style.display="block",s.style.left=`${g.clientX+14}px`,s.style.top=`${g.clientY+14}px`,s.style.display="block"}})},c=()=>{o.style.display="none",s.style.display="none",n=null},m=g=>{if(!e||!n)return;g.preventDefault(),g.stopPropagation(),g.stopImmediatePropagation();let p=n;if(D(p,["data-yns-comment-overlay","data-yns-design-overlay"]))return;let h=ve(p,200),R=p.getBoundingClientRect();window.parent.postMessage({type:"comment-click",data:{element:h,clickPosition:{x:g.clientX,y:g.clientY},elementRect:{top:R.top,left:R.left,width:R.width,height:R.height},pagePath:window.location.pathname}},"*")},v=g=>{g.key==="Escape"&&e&&(E(),window.parent.postMessage({type:"comment-mode-cleared"},"*"))};function k(){e=!0,document.body.style.cursor="crosshair",document.addEventListener("mousemove",l,!0),document.addEventListener("mouseleave",c),document.addEventListener("click",m,!0),document.addEventListener("keydown",v,!0)}function E(){e=!1,document.body.style.cursor="",document.removeEventListener("mousemove",l,!0),document.removeEventListener("mouseleave",c),document.removeEventListener("click",m,!0),document.removeEventListener("keydown",v,!0),o.style.display="none",s.style.display="none",n=null}let w=!1,u=()=>{w||(w=!0,requestAnimationFrame(()=>{w=!1,d()}))};window.addEventListener("scroll",u,{passive:!0}),window.addEventListener("resize",u,{passive:!0}),window.addEventListener("message",g=>{let p=g.data;!p||typeof p!="object"||(p.type==="comment-mode-toggle"&&(p.enabled?k():E()),p.type==="comment-pins-update"&&(t=p.pins??[],d()),p.type==="comment-pin-remove"&&(t=t.filter(h=>h.id!==p.pinId),d()))})}export{ae as mountFeedbackToolbar,Se as startSandboxInspectors};
1
+ function x(){typeof window>"u"||(console.log("[YNS Sandbox Inspectors] module evaluated"),L(),S())}x();var w=new Set(["HEAD","SCRIPT","STYLE","NOSCRIPT","HTML"]);function C(o){if(o.id)return`${o.tagName.toLowerCase()}#${CSS.escape(o.id)}`;let l=[],e=o;for(;e&&e!==document.body&&e!==document.documentElement;){let t=e.tagName.toLowerCase();if(e.id){l.unshift(`${t}#${CSS.escape(e.id)}`);break}let n=Array.from(e.classList).filter(u=>!u.startsWith("data-yns-"));n.length>0&&(t+=`.${n.map(u=>CSS.escape(u)).join(".")}`);let a=e.parentElement,f=e.tagName;if(a&&Array.from(a.children).filter(m=>m.tagName===f&&(n.length===0||n.every(y=>m.classList.contains(y)))).length>1){let m=Array.from(a.children).indexOf(e)+1;t+=`:nth-child(${m})`}l.unshift(t),e=e.parentElement}return l.join(" > ")}function E(o,l){let e=o.getBoundingClientRect(),t=window.getComputedStyle(o),n=(o.textContent??"").trim();return{tag:o.tagName.toLowerCase(),id:o.id||void 0,classes:Array.from(o.classList).filter(a=>!a.startsWith("data-yns-")),textContent:n.length>l?`${n.slice(0,l)}\u2026`:n,cssSelector:C(o),boundingRect:{top:e.top,left:e.left,width:e.width,height:e.height},computedStyles:{color:t.color,backgroundColor:t.backgroundColor,fontSize:t.fontSize,fontFamily:t.fontFamily,padding:t.padding,margin:t.margin}}}function v(o,l){if(!o?.tagName||w.has(o.tagName))return!0;for(let e of l)if(o.hasAttribute?.(e))return!0;return!1}function L(){let o=!1,l=null,e=null,t=document.createElement("div");t.setAttribute("data-yns-design-overlay","hover"),t.style.cssText=["position: fixed","pointer-events: none","z-index: 2147483646","border: 2px solid #3b82f6","background: rgba(59, 130, 246, 0.08)","border-radius: 3px","display: none","transition: top 0.05s, left 0.05s, width 0.05s, height 0.05s"].join(";");let n=document.createElement("div");n.setAttribute("data-yns-design-overlay","label"),n.style.cssText=["position: fixed","pointer-events: none","z-index: 2147483647","background: #3b82f6","color: #fff","font-size: 11px","font-family: ui-monospace, monospace","padding: 2px 6px","border-radius: 3px","white-space: nowrap","display: none"].join(";"),document.documentElement.appendChild(t),document.documentElement.appendChild(n);let a=document.createElement("style");a.setAttribute("data-yns-design-overlay","style"),a.textContent="[data-yns-selected] { outline: 2px solid #3b82f6 !important; outline-offset: 1px; }",document.head.appendChild(a);function f(d){let i=d.getBoundingClientRect();t.style.top=`${i.top}px`,t.style.left=`${i.left}px`,t.style.width=`${i.width}px`,t.style.height=`${i.height}px`,t.style.display="block";let r=Array.from(d.classList).filter(c=>!c.startsWith("data-yns-")),s=d.tagName.toLowerCase()+(r.length?`.${r[0]}`:"");n.textContent=s,n.style.left=`${i.left}px`,n.style.top=`${Math.max(0,i.top-22)}px`,n.style.display="block"}let u=d=>{let i=document.elementFromPoint(d.clientX,d.clientY);if(v(i,["data-yns-design-overlay"])){t.style.display="none",n.style.display="none",l=null;return}l=i,requestAnimationFrame(()=>{l===i&&o&&i&&f(i)})},m=()=>{t.style.display="none",n.style.display="none",l=null},y=d=>{if(!o||!l)return;d.preventDefault(),d.stopPropagation(),d.stopImmediatePropagation();let i=l;if(v(i,["data-yns-design-overlay"]))return;let r=E(i,120),s=r.cssSelector;e&&e.el.removeAttribute("data-yns-selected"),e&&e.cssSelector===s?(e=null,window.parent.postMessage({type:"element-deselected",data:r},"*")):(e={el:i,cssSelector:s},i.setAttribute("data-yns-selected",""),window.parent.postMessage({type:"element-selected",data:r},"*"))},g=d=>{d.key==="Escape"&&o&&(h(),window.parent.postMessage({type:"design-mode-cleared"},"*"))};function b(){o=!0,document.addEventListener("mousemove",u,!0),document.addEventListener("mouseleave",m),document.addEventListener("click",y,!0),document.addEventListener("keydown",g,!0)}function h(){o=!1,document.removeEventListener("mousemove",u,!0),document.removeEventListener("mouseleave",m),document.removeEventListener("click",y,!0),document.removeEventListener("keydown",g,!0),t.style.display="none",n.style.display="none",l=null,e&&(e.el.removeAttribute("data-yns-selected"),e=null)}window.addEventListener("message",d=>{let i=d.data;!i||typeof i!="object"||(i.type==="design-mode-toggle"&&(i.enabled?b():(h(),window.parent.postMessage({type:"design-mode-cleared"},"*"))),i.type==="design-mode-deselect"&&e&&(e.el.removeAttribute("data-yns-selected"),e=null))})}function S(){let o=!1,l=null,e=[],t=document.createElement("div");t.setAttribute("data-yns-comment-overlay","hover"),t.style.cssText=["position: fixed","pointer-events: none","z-index: 2147483644","border: 2px dashed #10b981","background: rgba(16, 185, 129, 0.06)","border-radius: 3px","display: none","transition: top 0.05s, left 0.05s, width 0.05s, height 0.05s"].join(";");let n=document.createElement("div");n.setAttribute("data-yns-comment-overlay","cursor-label"),n.textContent="Click to comment",n.style.cssText=["position: fixed","pointer-events: none","z-index: 2147483645","background: #059669","color: #fff","font-size: 11px","font-family: ui-sans-serif, system-ui, sans-serif","padding: 3px 8px","border-radius: 4px","white-space: nowrap","display: none","box-shadow: 0 2px 6px rgba(0,0,0,0.15)"].join(";");let a=document.createElement("div");a.setAttribute("data-yns-comment-overlay","pins"),a.style.cssText="position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2147483643;",document.documentElement.appendChild(t),document.documentElement.appendChild(n),document.documentElement.appendChild(a);function f(){a.innerHTML="";for(let r of e){let s=null;try{s=document.querySelector(r.selector)}catch{s=null}if(!s)continue;let c=s.getBoundingClientRect(),p=document.createElement("div");p.style.cssText=["position: fixed",`top: ${c.top-12}px`,`left: ${c.left+c.width/2-12}px`,"width: 24px","height: 24px","border-radius: 50%","background: #059669","color: #fff","display: flex","align-items: center","justify-content: center","font-size: 12px","font-weight: 600","font-family: ui-sans-serif, system-ui, sans-serif","box-shadow: 0 2px 8px rgba(0,0,0,0.2)","pointer-events: none"].join(";"),p.textContent=String(r.number),a.appendChild(p)}}let u=r=>{let s=document.elementFromPoint(r.clientX,r.clientY);if(v(s,["data-yns-comment-overlay","data-yns-design-overlay"])){t.style.display="none",n.style.display="none",l=null;return}l=s,requestAnimationFrame(()=>{if(l===s&&o&&s){let c=s.getBoundingClientRect();t.style.top=`${c.top}px`,t.style.left=`${c.left}px`,t.style.width=`${c.width}px`,t.style.height=`${c.height}px`,t.style.display="block",n.style.left=`${r.clientX+14}px`,n.style.top=`${r.clientY+14}px`,n.style.display="block"}})},m=()=>{t.style.display="none",n.style.display="none",l=null},y=r=>{if(!o||!l)return;r.preventDefault(),r.stopPropagation(),r.stopImmediatePropagation();let s=l;if(v(s,["data-yns-comment-overlay","data-yns-design-overlay"]))return;let c=E(s,200),p=s.getBoundingClientRect();window.parent.postMessage({type:"comment-click",data:{element:c,clickPosition:{x:r.clientX,y:r.clientY},elementRect:{top:p.top,left:p.left,width:p.width,height:p.height},pagePath:window.location.pathname}},"*")},g=r=>{r.key==="Escape"&&o&&(h(),window.parent.postMessage({type:"comment-mode-cleared"},"*"))};function b(){o=!0,document.body.style.cursor="crosshair",document.addEventListener("mousemove",u,!0),document.addEventListener("mouseleave",m),document.addEventListener("click",y,!0),document.addEventListener("keydown",g,!0)}function h(){o=!1,document.body.style.cursor="",document.removeEventListener("mousemove",u,!0),document.removeEventListener("mouseleave",m),document.removeEventListener("click",y,!0),document.removeEventListener("keydown",g,!0),t.style.display="none",n.style.display="none",l=null}let d=!1,i=()=>{d||(d=!0,requestAnimationFrame(()=>{d=!1,f()}))};window.addEventListener("scroll",i,{passive:!0}),window.addEventListener("resize",i,{passive:!0}),window.addEventListener("message",r=>{let s=r.data;!s||typeof s!="object"||(s.type==="comment-mode-toggle"&&(s.enabled?b():h()),s.type==="comment-pins-update"&&(e=s.pins??[],f()),s.type==="comment-pin-remove"&&(e=e.filter(c=>c.id!==s.pinId),f()))})}export{x as startSandboxInspectors};
5
2
  //# sourceMappingURL=browser.js.map